diff options
Diffstat (limited to 'versign.py')
-rw-r--r-- | versign.py | 30 |
1 files changed, 0 insertions, 30 deletions
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)' - |