def setupKey(self, subjectOrIssuer, value): if subjectOrIssuer == 'subject': self.subjectKey = pykey.RSAKey(value) elif subjectOrIssuer == 'issuer': self.issuerKey = pykey.RSAKey(value) else: raise UnknownKeyTargetError(subjectOrIssuer)
def __init__(self, paramStream): self.versionValue = 2 # a value of 2 is X509v3 self.signature = 'sha256WithRSAEncryption' self.issuer = 'Default Issuer' now = datetime.datetime.utcnow() currentYear = datetime.datetime.strptime(str(now.year), '%Y') aYearAndAWhile = datetime.timedelta(days=550) self.notBefore = currentYear - aYearAndAWhile self.notAfter = currentYear + aYearAndAWhile self.subject = 'Default Subject' self.signatureAlgorithm = 'sha256WithRSAEncryption' self.extensions = None self.subjectKey = pykey.RSAKey() self.issuerKey = pykey.RSAKey() self.decodeParams(paramStream) self.serialNumber = self.generateSerialNumber()