cleanup pwdreader for slip-0016

parent 4cb852e5
...@@ -33,7 +33,7 @@ def getFileEncKey(key): ...@@ -33,7 +33,7 @@ def getFileEncKey(key):
filekey, enckey = key[:len(key)/2], key[len(key)/2:] filekey, enckey = key[:len(key)/2], key[len(key)/2:]
FILENAME_MESS = '5f91add3fa1c3c76e90c90a3bd0999e2bd7833d06a483fe884ee60397aca277a' FILENAME_MESS = '5f91add3fa1c3c76e90c90a3bd0999e2bd7833d06a483fe884ee60397aca277a'
digest = hmac.new(filekey, FILENAME_MESS, hashlib.sha256).hexdigest() digest = hmac.new(filekey, FILENAME_MESS, hashlib.sha256).hexdigest()
filename = ''.join((digest, '.pswd')) filename = digest + '.pswd'
return [filename, filekey, enckey] return [filename, filekey, enckey]
# File level decryption and file reading # File level decryption and file reading
...@@ -80,8 +80,11 @@ def getDecryptedNonce(entry): ...@@ -80,8 +80,11 @@ def getDecryptedNonce(entry):
print print
print 'Waiting for TREZOR input ...' print 'Waiting for TREZOR input ...'
print print
title = entry['title'].replace("http://","").replace("https://","") if 'item' in entry:
ENC_KEY = ''.join(('Unlock ', title, ' for user ', entry['username'], '?')) item = entry['item'].replace('http://', '').replace('https://', '')
else:
item = entry['title'].replace('http://', '').replace('https://', '')
ENC_KEY = 'Unlock %s for user %s?' % (item, entry['username'])
ENC_VALUE = entry['nonce'] ENC_VALUE = entry['nonce']
decrypted_nonce = hexlify(client.decrypt_keyvalue( decrypted_nonce = hexlify(client.decrypt_keyvalue(
getPath(), getPath(),
...@@ -118,13 +121,13 @@ def main(): ...@@ -118,13 +121,13 @@ def main():
fileName = getFileEncKey(masterKey)[0] fileName = getFileEncKey(masterKey)[0]
#print 'file name:', fileName #print 'file name:', fileName
path = os.path.expanduser('~/Dropbox/Apps/TREZOR Passwords/') path = os.path.expanduser('~/Dropbox/Apps/TREZOR Password Manager/')
#print 'path to file:', path #print 'path to file:', path
encKey = getFileEncKey(masterKey)[2] encKey = getFileEncKey(masterKey)[2]
#print 'enckey:', encKey #print 'enckey:', encKey
full_path = ''.join((path, fileName)) full_path = path + fileName
parsed_json = decryptStorage(full_path, encKey) parsed_json = decryptStorage(full_path, encKey)
#list entries #list entries
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment