summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Shkardoon <ss23@ss23.geek.nz>2019-10-06 10:59:50 +0200
committerStephen Shkardoon <ss23@ss23.geek.nz>2019-10-06 10:59:50 +0200
commit2ede6519fad2ab15767632350e3c48d2a1903522 (patch)
tree96a4c8b19a2148c76a75a9395c0b763e75fe679f
parentAdd generate-otp.py script (diff)
downloadentrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.gz
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.bz2
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.lz
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.xz
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.zst
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.zip
-rw-r--r--README.md2
-rwxr-xr-xdecode-qr-uri.py14
2 files changed, 7 insertions, 9 deletions
diff --git a/README.md b/README.md
index 5ca3c3a..6fd582f 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Run this with the URI from a QR code to recieve the decrypted data. The decrypte
Example:
```
-$ ./generate-hmacs.py 'igmobileotp://?action=secactivate&enc=VRUq6IoLWQRCMRITZEHtHUSWJiPwgu%2FN1BFyUHE5kxuHIEYoE3zmNTrAHeeUM5S3gzCnTy%2F%2Bdnbu%2FsjjQW%2BNEISx8C4ra8rLpxOl8E8w4KXHgjeBRgdvSzl%2BbzX5RYRrQlWgK8hsBT4pQYE0eFgW2TmRbzXu1Mu7XjKDcwsJLew32jQC2qyPLP8hljnv2rHwwsMfhQwgJUJYfctwLWWEDUFukEckaZ4O&v=1&mac=mhVL8BWKaishMa5%2B' 54998317
+$ ./decode-qr-uri.py 'igmobileotp://?action=secactivate&enc=VRUq6IoLWQRCMRITZEHtHUSWJiPwgu%2FN1BFyUHE5kxuHIEYoE3zmNTrAHeeUM5S3gzCnTy%2F%2Bdnbu%2FsjjQW%2BNEISx8C4ra8rLpxOl8E8w4KXHgjeBRgdvSzl%2BbzX5RYRrQlWgK8hsBT4pQYE0eFgW2TmRbzXu1Mu7XjKDcwsJLew32jQC2qyPLP8hljnv2rHwwsMfhQwgJUJYfctwLWWEDUFukEckaZ4O&v=1&mac=mhVL8BWKaishMa5%2B' 54998317
{"sn":"48244-13456","ac":"1745-7712-6942-8698","policy":"{\"allowUnsecured\":\"false\",\"trustedExecution\":\"NOT_ALLOWED\"}","regurl":"myid.umc.edu\/igst"}
```
diff --git a/decode-qr-uri.py b/decode-qr-uri.py
index f376e38..711ce5b 100755
--- a/decode-qr-uri.py
+++ b/decode-qr-uri.py
@@ -1,6 +1,4 @@
#!/bin/env python3
-import hashlib
-import hmac
import urllib.parse
from hashlib import pbkdf2_hmac
import base64
@@ -56,11 +54,11 @@ logging.debug("KDF Salt: 0x%s", kdfSalt.hex())
# Run PBKDF2 to obtain our AES key
key = pbkdf2_hmac(
- hash_name = 'sha256',
- password = args.Password[0].encode('utf-8'),
- salt = kdfSalt,
- iterations = 1000,
- dklen = 64
+ hash_name='sha256',
+ password=args.Password[0].encode('utf-8'),
+ salt=kdfSalt,
+ iterations=1000,
+ dklen=64
)
logging.debug("KDF Output: 0x%s", key.hex())
@@ -99,7 +97,7 @@ logging.debug("IV: 0x%s", iv.hex())
logging.debug("AES Key: 0x%s", aesKey.hex())
# custom unpad, as pycrytodome does not support pkcs5
-unpad = lambda s : s[0:-(s[-1])]
+unpad = lambda s: s[0:-(s[-1])]
cipher = AES.new(aesKey, mode=AES.MODE_CBC, iv=iv)
decrypted_data = unpad(cipher.decrypt(encdata))