MCPcopy Create free account
hub / github.com/secdev/scapy / __call__

Method __call__

scapy/layers/tls/cert.py:901–922  ·  view source on GitHub ↗
(cls, cert_path=None, cryptography_obj=None)

Source from the content-addressed store, hash-verified

899 """
900
901 def __call__(cls, cert_path=None, cryptography_obj=None):
902 # This allows to import cryptography objects directly
903 if cryptography_obj is not None:
904 obj = _PKIObj(
905 "DER",
906 cryptography_obj.public_bytes(
907 encoding=serialization.Encoding.DER,
908 ),
909 )
910 else:
911 # Load from file
912 obj = _PKIObjMaker.__call__(cls, cert_path, _MAX_CERT_SIZE, "CERTIFICATE")
913 obj.__class__ = Cert
914 obj.marker = "CERTIFICATE"
915 try:
916 cert = X509_Cert(obj._der)
917 except Exception:
918 if conf.debug_dissector:
919 raise
920 raise Exception("Unable to import certificate")
921 obj.import_from_asn1pkt(cert)
922 return obj
923
924
925def _get_cert_sig_hashname(cert):

Callers

nothing calls this directly

Calls 4

X509_CertClass · 0.90
_PKIObjClass · 0.85
__call__Method · 0.45
import_from_asn1pktMethod · 0.45

Tested by

no test coverage detected