aboutsummaryrefslogtreecommitdiff
path: root/pow/POW-0.7/lib/pkix.py
diff options
context:
space:
mode:
Diffstat (limited to 'pow/POW-0.7/lib/pkix.py')
-rwxr-xr-xpow/POW-0.7/lib/pkix.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pow/POW-0.7/lib/pkix.py b/pow/POW-0.7/lib/pkix.py
index 41e50473..6262ed60 100755
--- a/pow/POW-0.7/lib/pkix.py
+++ b/pow/POW-0.7/lib/pkix.py
@@ -1228,6 +1228,14 @@ class CertificationRequest(Sequence):
contents = [ self.certificationRequestInfo, self.signatureAlgorithm, self.signatureValue ]
Sequence.__init__(self, contents, optional, default)
+ def sign(self, rsa, digestType):
+ driver = getCryptoDriver()
+ oid = driver.getOID(digestType)
+ self.certificationRequestInfo.subjectPublicKeyInfo.fromString(driver.toPublicDER(rsa))
+ signedText = driver.sign(rsa, oid, self.certificationRequestInfo.toString())
+ self.signatureAlgorithm.set([oid, None])
+ self.signatureValue.set(signedText)
+
def verify(self):
driver = getCryptoDriver()
oid = self.signatureAlgorithm.get()[0]
@@ -1250,6 +1258,9 @@ class CertificationRequest(Sequence):
return x
return None
+ def setExtensions(self, exts):
+ self.certificationRequestInfo.attributes.val.choices["set"][0].set(exts)
+
#---------- PKCS10 ----------#
#---------- GeneralNames object support ----------#
class OtherName(Sequence):
@@ -2045,5 +2056,3 @@ class Extension(Sequence):
return (oid, critical, ())
return (oid, critical, value)
-
-