Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def extract_cert_chain(pem_bytes: bytes) -> bytes:
def load_pem_certificate(certificate_data: bytes, password: Optional[bytes] = None) -> _Cert:
private_key = serialization.load_pem_private_key(certificate_data, password, backend=default_backend())
cert = x509.load_pem_x509_certificate(certificate_data, default_backend())
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec # CodeQL [SM02167] only used as a thumbprint/identifier
return _Cert(certificate_data, private_key, fingerprint)


Expand All @@ -120,7 +120,7 @@ def load_pkcs12_certificate(certificate_data: bytes, password: Optional[bytes] =
pem_sections = [key_bytes] + [c.public_bytes(Encoding.PEM) for c in [cert] + additional_certs]
pem_bytes = b"".join(pem_sections)

fingerprint = cert.fingerprint(hashes.SHA1()) # nosec
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec # CodeQL [SM02167] only used as a thumbprint/identifier

return _Cert(pem_bytes, private_key, fingerprint)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, pem_bytes: bytes, password: Optional[bytes] = None) -> None:
self._private_key = private_key

cert = x509.load_pem_x509_certificate(pem_bytes, default_backend())
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec # CodeQL [SM02167] only used as a thumbprint/identifier
sha256_fingerprint = cert.fingerprint(hashes.SHA256())
self._thumbprint = base64.urlsafe_b64encode(fingerprint).decode("utf-8")
self._sha256_thumbprint = base64.urlsafe_b64encode(sha256_fingerprint).decode("utf-8")
Expand Down
Loading