1
1
from Crypto .PublicKey import RSA
2
2
from Crypto .Hash import SHA1 , SHA224 , SHA256 , SHA384 , SHA512
3
- #from OpenSSL.crypto import load_certificate, FILETYPE_PEM, FILETYPE_ASN1, Error
4
3
from client_encryption .encryption_exception import CertificateError , PrivateKeyError , HashAlgorithmError
5
4
from cryptography import x509
6
5
from cryptography .hazmat .primitives .serialization import pkcs12
@@ -26,15 +25,15 @@ def load_encryption_certificate(certificate_path):
26
25
raise CertificateError ("Unable to load certificate." )
27
26
28
27
try :
29
- type = __get_crypto_file_type (certificate )
28
+ cert_type = __get_crypto_file_type (certificate )
30
29
31
- if type == FileType .FILETYPE_PEM :
30
+ if cert_type == FileType .FILETYPE_PEM :
32
31
cert = x509 .load_pem_x509_certificate (certificate )
33
32
return cert , Encoding .PEM
34
- if type == FileType .FILETYPE_ASN1 :
33
+ if cert_type == FileType .FILETYPE_ASN1 :
35
34
cert = x509 .load_der_x509_certificate (certificate )
36
35
return cert , Encoding .DER
37
- if type == FileType .FILETYPE_INVALID :
36
+ if cert_type == FileType .FILETYPE_INVALID :
38
37
raise CertificateError ("Wrong certificate format." )
39
38
except ValueError :
40
39
raise CertificateError ("Invalid certificate format." )
0 commit comments