diff options
author | Rob Austein <sra@hactrn.net> | 2014-01-07 15:03:59 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2014-01-07 15:03:59 +0000 |
commit | 26862c4593fbe4ef3d25d7646a046467eaa4cf1a (patch) | |
tree | 207c4e70b776c8551a3b935ab8c00e6ad34578ae /rpkid/rpki/x509.py | |
parent | 8851e2a4af52fe6df2b805f5f8666bec728b338b (diff) |
Clean up non-verifying CMS extraction methods.
svn path=/trunk/; revision=5617
Diffstat (limited to 'rpkid/rpki/x509.py')
-rw-r--r-- | rpkid/rpki/x509.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rpkid/rpki/x509.py b/rpkid/rpki/x509.py index 2a55e174..acac9bbd 100644 --- a/rpkid/rpki/x509.py +++ b/rpkid/rpki/x509.py @@ -1455,6 +1455,15 @@ class Wrapped_CMS_object(CMS_object): self.decode(CMS_object.extract(self)) return self.get_content() + def extract_if_needed(self): + """ + Extract inner content if needed. See caveats for .extract(), do + not use unless you really know what you are doing. + """ + + if self.content is None: + self.extract() + def _sign(self, cert, keypair, certs, crls, flags): """ Internal method to call POW to do CMS signature. This is split @@ -1564,10 +1573,7 @@ class ROA(DER_CMS_object): """ msg = DER_CMS_object.tracking_data(self, uri) try: - try: - self.get_POW().getVersion() - except rpki.POW.NotVerifiedError: - self.extract() + self.extract_if_needed() asn = self.get_POW().getASID() text = [] for prefixes in self.get_POW().getPrefixes(): |