MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / load_pem_private_key

Function load_pem_private_key

mitmproxy/certs.py:731–741  ·  view source on GitHub ↗

like cryptography's load_pem_private_key, but silently falls back to not using a password if the private key is unencrypted.

(data: bytes, password: bytes | None)

Source from the content-addressed store, hash-verified

729
730
731def load_pem_private_key(data: bytes, password: bytes | None) -> rsa.RSAPrivateKey:
732 """
733 like cryptography's load_pem_private_key, but silently falls back to not using a password
734 if the private key is unencrypted.
735 """
736 try:
737 return serialization.load_pem_private_key(data, password) # type: ignore
738 except TypeError:
739 if password is not None:
740 return load_pem_private_key(data, None)
741 raise

Callers 2

from_filesMethod · 0.85
add_cert_fileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…