From 923b0364e7fac251f5146b7ea8714e12586fc084 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 17 Jun 2009 14:37:59 +0000 Subject: Cleanup svn path=/scripts/Old/encode-test.py; revision=2532 --- scripts/Old/encode-test.py | 175 --------------------------------------------- 1 file changed, 175 deletions(-) delete mode 100755 scripts/Old/encode-test.py (limited to 'scripts/Old/encode-test.py') diff --git a/scripts/Old/encode-test.py b/scripts/Old/encode-test.py deleted file mode 100755 index b39a8d51..00000000 --- a/scripts/Old/encode-test.py +++ /dev/null @@ -1,175 +0,0 @@ -# $Id$ - -# Copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ARIN DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ARIN BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -import os - -def run(func, arg, *cmd): - i, o = func(cmd) - i.write(arg) - i.close() - value = o.read() - o.close() - return value - -def encode(xml, cer, key): - return run(os.popen2, xml, "openssl", "smime", "-sign", "-nodetach", "-outform", "PEM", "-signer", cer, "-inkey", key) - -def decode(cms, dir): - return run(os.popen2, cms, "openssl", "smime", "-verify", "-inform", "PEM", "-CApath", dir) - -def relaxng(xml, rng): - return run(os.popen4, xml, "xmllint", "--noout", "--relaxng", rng, "-") - -def main(): - dir = "biz-certs" - cer = "biz-certs/Alice-EE.cer" - key = "biz-certs/Alice-EE.key" - rng = "up-down-schema.rng" - - for x in xml: - print x - e = encode(x, cer, key) - print e - d = decode(e, dir) - print d - v = relaxng(d, rng) - print v - print "=====\n" - -# Ugly inline stuff here for initial testing - -xml = [ -''' - - 2001 - 17 - [Readable text] - -''', -''' - - - deadbeef - - -''', -''' - - - - deadbeef - - deadbeef - - -''', -''' - -''', -''' - - - - deadbeef - - - deadbeef - - -''', -''' - - - -''', -''' - - - -''' -] - -main() -- cgit v1.2.3