1 diff -aurb tlslite-0.3.8/tlslite/X509.py chromium/tlslite/X509.py
2 --- tlslite-0.3.8/tlslite/X509.py Fri Mar 19 18:43:19 2004
3 +++ chromium/tlslite/X509.py Wed Feb 29 11:53:54 2012
6 #Create a public key instance
7 self.publicKey = _createPublicRSAKey(n, e)
10 def getFingerprint(self):
11 """Get the hex-encoded fingerprint of this certificate.
12 diff -aurb tlslite-0.3.8/tlslite/X509CertChain.py chromium/tlslite/X509CertChain.py
13 --- tlslite-0.3.8/tlslite/X509CertChain.py Fri Mar 19 18:49:58 2004
14 +++ chromium/tlslite/X509CertChain.py Wed Feb 29 11:53:42 2012
16 """Class representing an X.509 certificate chain."""
18 from utils import cryptomath
19 +from X509 import X509
22 """This class represents a chain of X.509 certificates.
24 self.x509List = x509List
28 + def parseChain(self, s):
29 + """Parse a PEM-encoded X.509 certificate file chain file.
32 + @param s: A PEM-encoded (eg: Base64) X.509 certificate file, with every
33 + certificate wrapped within "-----BEGIN CERTIFICATE-----" and
34 + "-----END CERTIFICATE-----" tags). Extraneous data outside such tags,
35 + such as human readable representations, will be ignored.
38 + class PEMIterator(object):
39 + """Simple iterator over PEM-encoded certificates within a string.
42 + @ivar data: A string containing PEM-encoded (Base64) certificates,
43 + with every certificate wrapped within "-----BEGIN CERTIFICATE-----"
44 + and "-----END CERTIFICATE-----" tags). Extraneous data outside such
45 + tags, such as human readable representations, will be ignored.
47 + @type index: integer
48 + @ivar index: The current offset within data to begin iterating from.
51 + _CERTIFICATE_HEADER = "----BEGIN CERTIFICATE-----"
52 + """The PEM encoding block header for X.509 certificates."""
54 + _CERTIFICATE_FOOTER = "----END CERTIFICATE-----"
55 + """The PEM encoding block footer for X.509 certificates."""
57 + def __init__(self, s):
65 + """Iterates and returns the next L{tlslite.X509.X509}
66 + certificate in data.
68 + @rtype tlslite.X509.X509
71 + self.index = self.data.find(self._CERTIFICATE_HEADER,
73 + if self.index == -1:
75 + end = self.data.find(self._CERTIFICATE_FOOTER, self.index)
79 + certStr = self.data[self.index+len(self._CERTIFICATE_HEADER) :
81 + self.index = end + len(self._CERTIFICATE_FOOTER)
82 + bytes = cryptomath.base64ToBytes(certStr)
83 + return X509().parseBinary(bytes)
85 + self.x509List = list(PEMIterator(s))
88 def getNumCerts(self):
89 """Get the number of certificates in this chain.