Skip to content

Commit 52f3fd0

Browse files
addding JWE specific unit tests
1 parent f2b4d04 commit 52f3fd0

File tree

3 files changed

+389
-3
lines changed

3 files changed

+389
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,5 @@ venv.bak/
112112

113113
# Visual Studio
114114
.vs
115+
.vscode
116+
.vscode/*

client_encryption/encryption_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ def load_decryption_key(key_file_path, decryption_key_password=None):
5050
try:
5151
with open(key_file_path, "rb") as key_content:
5252
private_key = key_content.read()
53-
5453
# if key format is p12 (decryption_key_password is populated) then we have to retrieve the private key
5554
if decryption_key_password is not None:
5655
private_key = __load_pkcs12_private_key(private_key, decryption_key_password)
57-
5856
return RSA.importKey(private_key)
5957
except ValueError:
6058
raise PrivateKeyError("Wrong decryption key format.")
@@ -63,7 +61,6 @@ def load_decryption_key(key_file_path, decryption_key_password=None):
6361

6462

6563
def __load_pkcs12_private_key(pkcs_file, password):
66-
"""Load a private key in ASN1 format out of a PKCS#12 container."""
6764
private_key, certs, addcerts = pkcs12.load_key_and_certificates(pkcs_file, password.encode("utf-8"))
6865
return private_key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.TraditionalOpenSSL, serialization.NoEncryption())
6966

0 commit comments

Comments
 (0)