diff options
author | Rob Austein <sra@hactrn.net> | 2007-09-23 19:15:55 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-09-23 19:15:55 +0000 |
commit | 46909637df94d982e5ee8bfbb27994c02fef0861 (patch) | |
tree | 7d4f4ee831ce36d030b1ad7ec53641e90051e72b /scripts/rpki/cms.py | |
parent | 370b66fa68ca2181e49751bb1518667913259132 (diff) |
Checkpoint
svn path=/scripts/rpki/cms.py; revision=1009
Diffstat (limited to 'scripts/rpki/cms.py')
-rw-r--r-- | scripts/rpki/cms.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/rpki/cms.py b/scripts/rpki/cms.py index 633ab1dc..86a73643 100644 --- a/scripts/rpki/cms.py +++ b/scripts/rpki/cms.py @@ -6,7 +6,7 @@ For the moment these just call the OpenSSL CLI tool, which is slow, requires disk I/O, and likes PEM format. Fix this later. """ -import os, rpki.x509, rpki.exceptions +import os, rpki.x509, rpki.exceptions, lxml.etree # openssl smime -sign -nodetach -outform DER -signer biz-certs/Alice-EE.cer -certfile biz-certs/Alice-CA.cer -inkey biz-certs/Alice-EE.key -in PLAN -out PLAN.der @@ -65,3 +65,11 @@ def decode(cms, ta): return xml else: raise rpki.exceptions.CMSVerificationFailed, "CMS verification failed with status %s" % status + +def xml_decode(elt, ta): + """Composite routine to decode CMS-wrapped XML.""" + return lxml.etree.fromstring(decode(elt, ta)) + +def xml_encode(elt, key, certs): + """Composite routine to encode CMS-wrapped XML.""" + return encode(lxml.etree.tostring(elt, pretty_print=True, encoding="us-ascii", xml_declaration=True), key, certs) |