diff options
-rw-r--r-- | dosign.py | 19 | ||||
-rw-r--r-- | versign.py | 30 |
2 files changed, 0 insertions, 49 deletions
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)' - |