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

Method tree

scapy/layers/tls/cert.py:1600–1625  ·  view source on GitHub ↗

Get a tree-like object of the certificate list

(self)

Source from the content-addressed store, hash-verified

1598
1599 @property
1600 def tree(self):
1601 """
1602 Get a tree-like object of the certificate list
1603 """
1604 # We store the tree object as a dictionary that contains children.
1605 tree = [(x, []) for x in self.rootCAs]
1606
1607 # We'll empty this list eventually
1608 certList = list(self)
1609
1610 # We make a list of certificates we have to search children for, and iterate
1611 # through it until it's empty.
1612 todo = list(tree)
1613
1614 # Iterate
1615 while todo:
1616 cert, children = todo.pop()
1617 for c in certList:
1618 # Check if this certificate matches the one we're looking at
1619 if c.isIssuer(cert) and c != cert:
1620 item = (c, [])
1621 children.append(item)
1622 certList.remove(c)
1623 todo.append(item)
1624
1625 return tree
1626
1627 def getchain(self, cert):
1628 """

Callers

nothing calls this directly

Calls 4

popMethod · 0.80
isIssuerMethod · 0.45
appendMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected