| 1630 | """ |
| 1631 | |
| 1632 | def _rec_getchain(chain, curtree): |
| 1633 | # See if an element of the current tree signs the cert, if so add it to |
| 1634 | # the chain, else recurse. |
| 1635 | for c, subtree in curtree: |
| 1636 | curchain = chain + [c] |
| 1637 | # If 'cert' is issued by c |
| 1638 | if cert.isIssuer(c): |
| 1639 | # Final node of the chain ! |
| 1640 | # (add the final cert if not self signed) |
| 1641 | if c != cert: |
| 1642 | curchain += [cert] |
| 1643 | return curchain |
| 1644 | else: |
| 1645 | # Not the final node of the chain ! Recurse. |
| 1646 | curchain = _rec_getchain(curchain, subtree) |
| 1647 | if curchain: |
| 1648 | return curchain |
| 1649 | return None |
| 1650 | |
| 1651 | chain = _rec_getchain([], self.tree) |
| 1652 | if chain is not None: |