diff options
author | Rob Austein <sra@hactrn.net> | 2012-09-30 12:09:34 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2012-09-30 12:09:34 +0000 |
commit | 8a0d5c46589a8189e63f64fa8bec7c04cdcd7a3b (patch) | |
tree | 1772f8a5a43faec0680074dee2dbdcf068981487 | |
parent | ea8ff95dfac7fea29aab3a0345074186e86e41ce (diff) |
Implement conversion between DER and POW formats for PKCS10 class.
svn path=/branches/tk274/; revision=4741
-rw-r--r-- | rpkid/rpki/x509.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rpkid/rpki/x509.py b/rpkid/rpki/x509.py index 1cd01dca..67b07097 100644 --- a/rpkid/rpki/x509.py +++ b/rpkid/rpki/x509.py @@ -845,7 +845,7 @@ class PKCS10(DER_object): Class to hold a PKCS #10 request. """ - formats = ("DER", "POWpkix") + formats = ("DER", "POW", "POWpkix") pem_converter = PEM_converter("CERTIFICATE REQUEST") def get_DER(self): @@ -855,11 +855,22 @@ class PKCS10(DER_object): self.check() if self.DER: return self.DER + if self.POW: + self.DER = self.POW.derWrite() if self.POWpkix: self.DER = self.POWpkix.toString() return self.get_DER() raise rpki.exceptions.DERObjectConversionError, "No conversion path to DER available" + def get_POW(self): + """ + Get the rpki.POW value of this certification request. + """ + self.check() + if not self.POW: + self.POW = rpki.POW.PKCS10.derRead(self.get_DER()) + return self.POW + def get_POWpkix(self): """ Get the rpki.POW.pkix value of this certification request. |