aboutsummaryrefslogtreecommitdiff
path: root/scripts/rpki/x509.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2007-10-05 05:01:06 +0000
committerRob Austein <sra@hactrn.net>2007-10-05 05:01:06 +0000
commit258b05bae4a6265b4e7835bb132aafd2c7c6a972 (patch)
treebeab460d76edfcc62b8fd751dcf382ec30be6e9b /scripts/rpki/x509.py
parent6cbac857412f4042087c467a7c3f791fe80c87d4 (diff)
PKCS #10 generation
svn path=/pow/POW-0.7/lib/pkix.py; revision=1096
Diffstat (limited to 'scripts/rpki/x509.py')
-rw-r--r--scripts/rpki/x509.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/rpki/x509.py b/scripts/rpki/x509.py
index 4aaeb695..6a030490 100644
--- a/scripts/rpki/x509.py
+++ b/scripts/rpki/x509.py
@@ -417,6 +417,20 @@ class PKCS10(DER_object):
# understand what the spec is telling me to do in this case.
assert "subjectInfoAccess" in req_exts, "Can't (yet) handle PKCS #10 without an SIA extension"
+ @classmethod
+ def create(cls, keypair, sia):
+ """Create a new request for a given keypair, including given SIA value."""
+ req = POW.pkix.CertificationRequest()
+ req.version.set(0)
+ exts = [ ("basicConstraints", True, (1, None)),
+ ("keyUsage", True, (0, 0, 0, 0, 0, 1, 1)),
+ ("subjectInfoAccess", False, sia) ]
+ for x in exts:
+ x[0] = POW.pkix.obj2oid(x[0])
+ req.setExtension(exts)
+ req.sign(keypair)
+ return cls(POWpkix = req)
+
class RSA_Keypair(DER_object):
"""Class to hold an RSA key pair."""