mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-27 15:51:02 +00:00
Refactored decrypting of password, now uses the same path for both create and mount
This commit is contained in:
parent
430362bd31
commit
f48646ac83
@ -72,18 +72,7 @@ def main():
|
|||||||
rootdir = os.environ['encfs_root'] # Read "man encfs" for more
|
rootdir = os.environ['encfs_root'] # Read "man encfs" for more
|
||||||
passw_file = os.path.join(rootdir, 'password.dat')
|
passw_file = os.path.join(rootdir, 'password.dat')
|
||||||
|
|
||||||
if os.path.exists(passw_file):
|
if not os.path.exists(passw_file):
|
||||||
# Existing encfs drive, let's load password
|
|
||||||
|
|
||||||
sys.stderr.write('Please confirm action on your device.\n')
|
|
||||||
label, passw_encrypted, bip32_path = open(passw_file, 'r').read().split(',')
|
|
||||||
passw = client.decrypt_keyvalue(json.loads(binascii.unhexlify(bip32_path)),
|
|
||||||
binascii.unhexlify(label),
|
|
||||||
binascii.unhexlify(passw_encrypted),
|
|
||||||
False, True)
|
|
||||||
print passw
|
|
||||||
|
|
||||||
else:
|
|
||||||
# New encfs drive, let's generate password
|
# New encfs drive, let's generate password
|
||||||
|
|
||||||
sys.stderr.write('Please provide label for new drive: ')
|
sys.stderr.write('Please provide label for new drive: ')
|
||||||
@ -108,7 +97,16 @@ def main():
|
|||||||
',' + binascii.hexlify(json.dumps(bip32_path)))
|
',' + binascii.hexlify(json.dumps(bip32_path)))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
print passw
|
# Let's load password
|
||||||
|
|
||||||
|
sys.stderr.write('Please confirm action on your device.\n')
|
||||||
|
label, passw_encrypted, bip32_path = open(passw_file, 'r').read().split(',')
|
||||||
|
passw = client.decrypt_keyvalue(json.loads(binascii.unhexlify(bip32_path)),
|
||||||
|
binascii.unhexlify(label),
|
||||||
|
binascii.unhexlify(passw_encrypted),
|
||||||
|
False, True)
|
||||||
|
print passw
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user