Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: third_party/tlslite/tlslite/X509.py

Issue 9515015: Support reading PEM files in TLSLite (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix pem blocks Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 """Class representing an X.509 certificate.""" 1 """Class representing an X.509 certificate."""
2 2
3 from utils.ASN1Parser import ASN1Parser 3 from utils.ASN1Parser import ASN1Parser
4 from utils.cryptomath import * 4 from utils.cryptomath import *
5 from utils.keyfactory import _createPublicRSAKey 5 from utils.keyfactory import _createPublicRSAKey
6 6
7 7
8 class X509: 8 class X509:
9 """This class represents an X.509 certificate. 9 """This class represents an X.509 certificate.
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #Get the modulus and exponent 92 #Get the modulus and exponent
93 modulusP = subjectPublicKeyP.getChild(0) 93 modulusP = subjectPublicKeyP.getChild(0)
94 publicExponentP = subjectPublicKeyP.getChild(1) 94 publicExponentP = subjectPublicKeyP.getChild(1)
95 95
96 #Decode them into numbers 96 #Decode them into numbers
97 n = bytesToNumber(modulusP.value) 97 n = bytesToNumber(modulusP.value)
98 e = bytesToNumber(publicExponentP.value) 98 e = bytesToNumber(publicExponentP.value)
99 99
100 #Create a public key instance 100 #Create a public key instance
101 self.publicKey = _createPublicRSAKey(n, e) 101 self.publicKey = _createPublicRSAKey(n, e)
102 return self
wtc 2012/03/02 23:32:18 Is it a bug for a method to be missing a return st
102 103
103 def getFingerprint(self): 104 def getFingerprint(self):
104 """Get the hex-encoded fingerprint of this certificate. 105 """Get the hex-encoded fingerprint of this certificate.
105 106
106 @rtype: str 107 @rtype: str
107 @return: A hex-encoded fingerprint. 108 @return: A hex-encoded fingerprint.
108 """ 109 """
109 return sha.sha(self.bytes).hexdigest() 110 return sha.sha(self.bytes).hexdigest()
110 111
111 def getCommonName(self): 112 def getCommonName(self):
(...skipping 20 matching lines...) Expand all
132 if e[0] == cryptlib_py.CRYPT_ERROR_NOTFOUND: 133 if e[0] == cryptlib_py.CRYPT_ERROR_NOTFOUND:
133 returnVal = None 134 returnVal = None
134 return returnVal 135 return returnVal
135 finally: 136 finally:
136 cryptlib_py.cryptDestroyCert(c) 137 cryptlib_py.cryptDestroyCert(c)
137 138
138 def writeBytes(self): 139 def writeBytes(self):
139 return self.bytes 140 return self.bytes
140 141
141 142
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698