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

Method __init__

scapy/layers/tls/cert.py:1458–1491  ·  view source on GitHub ↗

Construct a list of certificates/CRLs to be used as list of ROOT certificates.

(
        self,
        certList: Union[Self, List[Cert], List[CSR], Cert, str],
    )

Source from the content-addressed store, hash-verified

1456 """
1457
1458 def __init__(
1459 self,
1460 certList: Union[Self, List[Cert], List[CSR], Cert, str],
1461 ):
1462 """
1463 Construct a list of certificates/CRLs to be used as list of ROOT certificates.
1464 """
1465 # Parse the certificate list / CA
1466 if isinstance(certList, str):
1467 # It's a path. First get the _PKIObj
1468 obj = _PKIObjMaker.__call__(
1469 CertList, certList, _MAX_CERT_SIZE, "CERTIFICATE"
1470 )
1471
1472 # Then parse the der until there's nothing left
1473 certList = []
1474 payload = obj._der
1475 while payload:
1476 cert = X509_Cert(payload)
1477 if conf.raw_layer in cert.payload:
1478 payload = cert.payload.load
1479 else:
1480 payload = None
1481 cert.remove_payload()
1482 certList.append(Cert(cert))
1483
1484 self.frmt = obj.frmt
1485 elif isinstance(certList, Cert):
1486 certList = [certList]
1487 self.frmt = "PEM"
1488 else:
1489 self.frmt = "PEM"
1490
1491 super(CertList, self).__init__(certList)
1492
1493 def findCertBySid(self, sid):
1494 """

Callers

nothing calls this directly

Calls 6

X509_CertClass · 0.90
CertClass · 0.85
__call__Method · 0.45
remove_payloadMethod · 0.45
appendMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected