1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-23 13:51:00 +00:00

tools: update encfs_aes_getpass to work with Py3

probably fixes #169
This commit is contained in:
matejcik 2018-04-16 17:21:29 +02:00
parent fd16bbfc8e
commit 9255507529

View File

@ -98,13 +98,15 @@ def main():
raise ValueError("32 bytes password expected") raise ValueError("32 bytes password expected")
bip32_path = [10, 0] bip32_path = [10, 0]
sys.stderr.write('Generated password is {}\n'.format(passw))
passw_encrypted = client.encrypt_keyvalue(bip32_path, label, passw, False, True) passw_encrypted = client.encrypt_keyvalue(bip32_path, label, passw, False, True)
sys.stderr.write('Encrypted password is {}\n'.format(passw_encrypted))
data = {'label': label, data = {'label': label,
'bip32_path': bip32_path, 'bip32_path': bip32_path,
'password_encrypted_hex': binascii.hexlify(passw_encrypted)} 'password_encrypted_hex': binascii.hexlify(passw_encrypted).decode('ascii')}
json.dump(data, open(passw_file, 'wb')) json.dump(data, open(passw_file, 'w'))
# Let's load password # Let's load password
data = json.load(open(passw_file, 'r')) data = json.load(open(passw_file, 'r'))
@ -115,6 +117,7 @@ def main():
binascii.unhexlify(data['password_encrypted_hex']), binascii.unhexlify(data['password_encrypted_hex']),
False, True) False, True)
sys.stderr.write('Submitting password {}\n'.format(passw))
print(passw) print(passw)