diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-01-16 19:08:12 -0600 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2019-01-16 20:08:12 -0500 |
commit | c6656af81d3b4440d0d1032fd82e64d717541d62 (patch) | |
tree | 494efaf4002a90fe79b114cd4d189f1c07411d92 /src | |
parent | c33ef91143c93fa7d59214f88fd5954b1bb3df09 (diff) | |
download | cryptography-c6656af81d3b4440d0d1032fd82e64d717541d62.tar.gz cryptography-c6656af81d3b4440d0d1032fd82e64d717541d62.tar.bz2 cryptography-c6656af81d3b4440d0d1032fd82e64d717541d62.zip |
add support for byteslike password/data to load_{pem,der}_private_key (#4693)
* add support for byteslike password/data to load_{pem,der}_private_key
* pypy 5.4 can't do memoryview from_buffer
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/backend.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py index 3ab34c17..fd6057f8 100644 --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -1224,11 +1224,9 @@ class Backend(object): def _load_key(self, openssl_read_func, convert_func, data, password): mem_bio = self._bytes_to_bio(data) - if password is not None: - utils._check_byteslike("password", password) - userdata = self._ffi.new("CRYPTOGRAPHY_PASSWORD_DATA *") if password is not None: + utils._check_byteslike("password", password) password_ptr = self._ffi.from_buffer(password) userdata.password = password_ptr userdata.length = len(password) |