aboutsummaryrefslogtreecommitdiff
path: root/scripts/rpki/cms.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2007-10-09 14:37:02 +0000
committerRob Austein <sra@hactrn.net>2007-10-09 14:37:02 +0000
commitc51d24684cf5d16080081e6fea6b25c1cd717645 (patch)
tree834d61d44af04e649f146e566c170ff5dc9e09c6 /scripts/rpki/cms.py
parentf195daa6afd37bd7c48c1c2ae5738adee012d90f (diff)
Fix naming of CMS functions (encode -> sign, decode -> verify).
svn path=/scripts/irbe-cli.py; revision=1129
Diffstat (limited to 'scripts/rpki/cms.py')
-rw-r--r--scripts/rpki/cms.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/rpki/cms.py b/scripts/rpki/cms.py
index 12343317..604a9ca1 100644
--- a/scripts/rpki/cms.py
+++ b/scripts/rpki/cms.py
@@ -10,8 +10,8 @@ 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
-def encode(plaintext, keypair, certs):
- """Encode plaintext as CMS signed with a specified key and bag of certificates.
+def sign(plaintext, keypair, certs):
+ """Sign plaintext as CMS with specified key and bag of certificates.
We have to sort the certificates into the correct order before the
OpenSSL CLI tool will accept them. rpki.x509 handles that for us.
@@ -51,8 +51,8 @@ def encode(plaintext, keypair, certs):
# openssl smime -verify -inform DER -in PLAN.der -CAfile biz-certs/Alice-Root.cer
-def decode(cms, ta):
- """Decode and check the signature of a chunk of CMS.
+def verify(cms, ta):
+ """Verify the signature of a chunk of CMS.
Returns the plaintext on success. If OpenSSL CLI tool reports
anything other than successful verification, we raise an exception.
@@ -80,10 +80,10 @@ def decode(cms, ta):
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_verify(elt, ta):
+ """Composite routine to verify CMS-wrapped XML."""
+ return lxml.etree.fromstring(verify(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)
+def xml_sign(elt, key, certs):
+ """Composite routine to sign CMS-wrapped XML."""
+ return sign(lxml.etree.tostring(elt, pretty_print=True, encoding="us-ascii", xml_declaration=True), key, certs)