From a48c542228cfec15ad9023bc7fe9a9d9cd1aeb2c Mon Sep 17 00:00:00 2001 From: equinox Date: Fri, 1 Apr 2011 06:42:37 +0200 Subject: remove old testing programs --- dosign.py | 19 ------------------- versign.py | 30 ------------------------------ 2 files changed, 49 deletions(-) delete mode 100644 dosign.py delete mode 100644 versign.py diff --git a/dosign.py b/dosign.py deleted file mode 100644 index e0d3465..0000000 --- a/dosign.py +++ /dev/null @@ -1,19 +0,0 @@ -import M2Crypto.RSA -import M2Crypto.EVP -import time -import base64, urllib - -ts = int(time.time()) -user = 'equinox' -data = '%d:%s' % (ts, user) - -algo = 'sha256' - -digest = M2Crypto.EVP.MessageDigest(algo) -digest.update(data) -digval = digest.final() - -key = M2Crypto.RSA.load_key('rsa.pem') -signature = key.sign(digval, algo = algo) - -print urllib.urlencode([('user', user), ('ts', ts), ('signature', base64.urlsafe_b64encode(signature))]) diff --git a/versign.py b/versign.py deleted file mode 100644 index aa406df..0000000 --- a/versign.py +++ /dev/null @@ -1,30 +0,0 @@ -import M2Crypto.RSA -import M2Crypto.EVP -import time, sys -import base64, cgi - -str = sys.argv[1] -data = cgi.parse_qs(str) - -ts = int(data['ts'][0]) -user = data['user'][0] -signature = base64.urlsafe_b64decode(data['signature'][0]) - -data = '%d:%s' % (ts, user) - -algo = 'sha256' - -digest = M2Crypto.EVP.MessageDigest(algo) -digest.update(data) -digval = digest.final() - -key = M2Crypto.RSA.load_pub_key('rsa.pub') - -try: - if key.verify(digval, signature, algo = algo): - print 'OKAY' - else: - print 'FAIL' -except: - print 'FAIL (hard)' - -- cgit v1.2.1