diff options
author | Marko Kreen <markokr@gmail.com> | 2020-05-25 21:17:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-25 13:17:25 -0500 |
commit | 9470f67a3086e4c003ab27ca6a2209dae9b1a9e6 (patch) | |
tree | e4ec2d6259f68c1466ba0eb4706418d8338d6391 /src/cryptography/hazmat/backends/openssl/x448.py | |
parent | 27f04412b5874374f00aab388c9a8c37d257f1ef (diff) | |
download | cryptography-9470f67a3086e4c003ab27ca6a2209dae9b1a9e6.tar.gz cryptography-9470f67a3086e4c003ab27ca6a2209dae9b1a9e6.tar.bz2 cryptography-9470f67a3086e4c003ab27ca6a2209dae9b1a9e6.zip |
Cleanup serialize (#5149)
* Additional tests for public/private_bytes
They expose few places that raise TypeError and AssertionError!
before, and ValueError later.
* Cleanup of private_bytes() backend
Also pass key itself down to backend.
* Cleanup of public_bytes() backend
* Test handling of unsupported key type
Diffstat (limited to 'src/cryptography/hazmat/backends/openssl/x448.py')
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/x448.py | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x448.py b/src/cryptography/hazmat/backends/openssl/x448.py index fe0dcd9c..3de35b43 100644 --- a/src/cryptography/hazmat/backends/openssl/x448.py +++ b/src/cryptography/hazmat/backends/openssl/x448.py @@ -35,15 +35,6 @@ class _X448PublicKey(object): return self._raw_public_bytes() - if ( - encoding in serialization._PEM_DER and - format is not serialization.PublicFormat.SubjectPublicKeyInfo - ): - raise ValueError( - "format must be SubjectPublicKeyInfo when encoding is PEM or " - "DER" - ) - return self._backend._public_key_bytes( encoding, format, self, self._evp_pkey, None ) @@ -100,16 +91,8 @@ class _X448PrivateKey(object): return self._raw_private_bytes() - if ( - encoding in serialization._PEM_DER and - format is not serialization.PrivateFormat.PKCS8 - ): - raise ValueError( - "format must be PKCS8 when encoding is PEM or DER" - ) - return self._backend._private_key_bytes( - encoding, format, encryption_algorithm, self._evp_pkey, None + encoding, format, encryption_algorithm, self, self._evp_pkey, None ) def _raw_private_bytes(self): |