1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

encrypt->encrypt_keyvalue, decrypt->decrypt_keyvalue

This commit is contained in:
Pavol Rusnak 2014-06-12 16:08:20 +02:00
parent f164e59d86
commit aa4fa425a3

View File

@ -149,12 +149,12 @@ class Commands(object):
signature = base64.b64decode(args.signature) signature = base64.b64decode(args.signature)
return self.client.verify_message(args.address, signature, args.message) return self.client.verify_message(args.address, signature, args.message)
def encrypt(self, args): def encrypt_keyvalue(self, args):
address_n = self.client.expand_path(args.n) address_n = self.client.expand_path(args.n)
ret = self.client.encrypt_keyvalue(address_n, args.key, args.value) ret = self.client.encrypt_keyvalue(address_n, args.key, args.value)
return binascii.hexlify(ret) return binascii.hexlify(ret)
def decrypt(self, args): def decrypt_keyvalue(self, args):
address_n = self.client.expand_path(args.n) address_n = self.client.expand_path(args.n)
value = binascii.unhexlify(args.value) value = binascii.unhexlify(args.value)
ret = self.client.decrypt_keyvalue(address_n, args.key, value) ret = self.client.decrypt_keyvalue(address_n, args.key, value)
@ -185,8 +185,8 @@ class Commands(object):
reset_device.help = 'Perform device setup and generate new seed' reset_device.help = 'Perform device setup and generate new seed'
sign_message.help = 'Sign message using address of given path' sign_message.help = 'Sign message using address of given path'
verify_message.help = 'Verify message' verify_message.help = 'Verify message'
encrypt.help = 'Encrypt value by given key and path' encrypt_keyvalue.help = 'Encrypt value by given key and path'
decrypt.help = 'Decrypt value by given key and path' decrypt_keyvalue.help = 'Decrypt value by given key and path'
firmware_update.help = 'Upload new firmware to device (must be in bootloader mode)' firmware_update.help = 'Upload new firmware to device (must be in bootloader mode)'
get_address.arguments = ( get_address.arguments = (
@ -255,13 +255,13 @@ class Commands(object):
(('message',), {'type': str}), (('message',), {'type': str}),
) )
encrypt.arguments = ( encrypt_keyvalue.arguments = (
(('-n', '-address'), {'type': str}), (('-n', '-address'), {'type': str}),
(('key',), {'type': str}), (('key',), {'type': str}),
(('value',), {'type': str}), (('value',), {'type': str}),
) )
decrypt.arguments = ( decrypt_keyvalue.arguments = (
(('-n', '-address'), {'type': str}), (('-n', '-address'), {'type': str}),
(('key',), {'type': str}), (('key',), {'type': str}),
(('value',), {'type': str}), (('value',), {'type': str}),