mirror of
https://github.com/openkmip/pykmip
synced 2025-12-15 15:53:36 +00:00
Add cryptography >= 39.0.0 support
The cryptography release 39.0.0 added a new parameter to the backend.load_pem_private_key and backend.load_der_private_key that's required. This patch uses the serialization method to load keys because there the new parameter is optional. https://cryptography.io/en/latest/changelog/#v39-0-0 This patch fixes the tests test_encrypt_decrypt_asymmetric
This commit is contained in:
committed by
arp102
parent
0a3e39143f
commit
652d5cab67
@@ -929,18 +929,18 @@ class CryptographyEngine(api.CryptographicEngine):
|
||||
"decryption.".format(padding_method)
|
||||
)
|
||||
|
||||
backend = default_backend()
|
||||
|
||||
try:
|
||||
private_key = backend.load_der_private_key(
|
||||
private_key = serialization.load_der_private_key(
|
||||
decryption_key,
|
||||
None
|
||||
password=None,
|
||||
backend=default_backend()
|
||||
)
|
||||
except Exception:
|
||||
try:
|
||||
private_key = backend.load_pem_private_key(
|
||||
private_key = serialization.load_pem_private_key(
|
||||
decryption_key,
|
||||
None
|
||||
password=None,
|
||||
backend=default_backend()
|
||||
)
|
||||
except Exception:
|
||||
raise exceptions.CryptographicFailure(
|
||||
|
||||
Reference in New Issue
Block a user