11import json
22from Crypto .Hash import SHA256
3- from client_encryption import encoding_utils
4- from client_encryption .encryption_utils import load_encryption_certificate , load_decryption_key , validate_hash_algorithm
53from cryptography .hazmat .primitives .serialization import PublicFormat , Encoding
64
5+ from client_encryption import encoding_utils
6+ from client_encryption .encryption_utils import load_encryption_certificate , load_decryption_key , validate_hash_algorithm
77
88
99class FieldLevelEncryptionConfig (object ):
@@ -28,12 +28,14 @@ def __init__(self, conf):
2828 x509_cert , cert_type = load_encryption_certificate (json_config ["encryptionCertificate" ])
2929 self ._encryption_certificate = x509_cert
3030 # Fixed encoding is required, regardless of initial certificate encoding to ensure correct calculation of fingerprint value
31- self ._encryption_certificate_type = Encoding .DER
31+ self ._encryption_certificate_type = Encoding .DER
3232 self ._encryption_key_fingerprint = \
33- json_config .get ("encryptionKeyFingerprint" ,self .__compute_fingerprint (x509_cert .public_key ().public_bytes (Encoding .DER , PublicFormat .SubjectPublicKeyInfo )))
33+ json_config .get ("encryptionKeyFingerprint" , self .__compute_fingerprint (
34+ x509_cert .public_key ().public_bytes (Encoding .DER , PublicFormat .SubjectPublicKeyInfo )))
3435 self ._encryption_certificate_fingerprint = \
35- json_config .get ("encryptionCertificateFingerprint" , self .__compute_fingerprint (x509_cert .public_bytes (Encoding .DER )))
36-
36+ json_config .get ("encryptionCertificateFingerprint" ,
37+ self .__compute_fingerprint (x509_cert .public_bytes (Encoding .DER )))
38+
3739 else :
3840 self ._encryption_certificate = None
3941 self ._encryption_key_fingerprint = None
@@ -54,11 +56,11 @@ def __init__(self, conf):
5456 self ._encrypted_key_field_name = json_config ["encryptedKeyFieldName" ]
5557 self ._encrypted_value_field_name = json_config ["encryptedValueFieldName" ]
5658
57- self ._encryption_certificate_fingerprint_field_name = \
59+ self ._encryption_certificate_fingerprint_field_name = \
5860 json_config .get ("encryptionCertificateFingerprintFieldName" , None )
59- self ._encryption_key_fingerprint_field_name = \
61+ self ._encryption_key_fingerprint_field_name = \
6062 json_config .get ("encryptionKeyFingerprintFieldName" , None )
61- self ._oaep_padding_digest_algorithm_field_name = \
63+ self ._oaep_padding_digest_algorithm_field_name = \
6264 json_config .get ("oaepPaddingDigestAlgorithmFieldName" , None )
6365
6466 self ._use_http_headers = json_config .get ("useHttpHeaders" , False )
@@ -74,6 +76,7 @@ def encryption_certificate(self):
7476 @property
7577 def encryption_certificate_type (self ):
7678 return self ._encryption_certificate_type
79+
7780 @property
7881 def encryption_key_fingerprint (self ):
7982 return self ._encryption_key_fingerprint
0 commit comments