aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2007-11-02 03:47:25 +0000
committerRob Austein <sra@hactrn.net>2007-11-02 03:47:25 +0000
commitdcdf9ef1787cb0a4e86de1c37f50618b89974fb5 (patch)
tree66dbb156a5eda4dbd313819c330fe5c798a3b6b6
parent73b48ecc296883031e67f6806044dece8a878709 (diff)
Checkpoint
svn path=/pow/POW-0.7/lib/pkix.py; revision=1231
-rwxr-xr-xpow/POW-0.7/lib/pkix.py3
-rw-r--r--scripts/rpki/exceptions.py3
-rw-r--r--scripts/rpki/sql.py2
-rw-r--r--scripts/rpki/up_down.py8
-rw-r--r--scripts/rpki/x509.py2
5 files changed, 14 insertions, 4 deletions
diff --git a/pow/POW-0.7/lib/pkix.py b/pow/POW-0.7/lib/pkix.py
index a4641085..65f62442 100755
--- a/pow/POW-0.7/lib/pkix.py
+++ b/pow/POW-0.7/lib/pkix.py
@@ -1259,7 +1259,8 @@ class CertificationRequest(Sequence):
return None
def setExtensions(self, exts):
- self.certificationRequestInfo.attributes.val.choices["set"][0].set(exts)
+ self.certificationRequestInfo.attributes.oid.set((1, 2, 840, 113549, 1, 9, 14))
+ self.certificationRequestInfo.attributes.val.set(("set", [exts]))
#---------- PKCS10 ----------#
#---------- GeneralNames object support ----------#
diff --git a/scripts/rpki/exceptions.py b/scripts/rpki/exceptions.py
index e3a9da25..2108d531 100644
--- a/scripts/rpki/exceptions.py
+++ b/scripts/rpki/exceptions.py
@@ -43,3 +43,6 @@ class NotImplementedYet(Exception):
class BadPKCS10(Exception):
"""Bad PKCS #10 object."""
+
+class UpstreamError(Exception):
+ """Received an error from upstream."""
diff --git a/scripts/rpki/sql.py b/scripts/rpki/sql.py
index 076542d2..12b5b4f0 100644
--- a/scripts/rpki/sql.py
+++ b/scripts/rpki/sql.py
@@ -256,7 +256,7 @@ class ca_obj(sql_persistant):
self.sia_uri = self.construct_sia_uri(gctx, parent, rc)
ca_detail = ca_detail_obj.create(gctx, self)
issue_response = rpki.up_down.issue_pdu.query(gctx, parent, self, ca_detail)
- issue_response.check()
+ issue_response.payload.check_syntax()
ca_detail.latest_ca_cert = issue_response.classes[0].certs[0]
ca_detail.state = "active"
ca_detail.sql_mark_dirty()
diff --git a/scripts/rpki/up_down.py b/scripts/rpki/up_down.py
index edb70657..d4b62153 100644
--- a/scripts/rpki/up_down.py
+++ b/scripts/rpki/up_down.py
@@ -315,7 +315,7 @@ class issue_pdu(base_elt):
class issue_response_pdu(class_response_syntax):
"""Up-Down protocol "issue_response" PDU."""
- def check(self):
+ def check_syntax(self):
"""Check whether this looks like a reasonable issue_response PDU.
XML schema should be tighter for this response.
"""
@@ -419,6 +419,12 @@ class error_response_pdu(base_elt):
elt.text = str(self.status)
return [elt]
+ def check(self):
+ """Handle an error response. For the moment, just raise an
+ exception, eventually figure out something more clever to do.
+ """
+ raise rpki.exceptions.UpstreamError, self.codes[self.status]
+
class message_pdu(base_elt):
"""Up-Down protocol message wrapper PDU."""
diff --git a/scripts/rpki/x509.py b/scripts/rpki/x509.py
index 60a86017..78be04c0 100644
--- a/scripts/rpki/x509.py
+++ b/scripts/rpki/x509.py
@@ -474,7 +474,7 @@ class PKCS10(DER_object):
@classmethod
def create(cls, keypair, exts = None):
- """Create a new request for a given keypair, including given SIA value."""
+ """Create a new request for a given keypair, including given extensions."""
cn = "".join(("%02X" % ord(i) for i in keypair.get_SKI()))
req = POW.pkix.CertificationRequest()
req.certificationRequestInfo.version.set(0)