diff --git a/cmdtr.py b/cmdtr.py index 50ce2bd35e..b519d51699 100755 --- a/cmdtr.py +++ b/cmdtr.py @@ -149,6 +149,19 @@ class Commands(object): signature = base64.b64decode(args.signature) return self.client.verify_message(args.address, signature, args.message) + def encrypt_message(self, args): + address_n = self.client.expand_path(args.n) + pubkey = binascii.unhexlify(args.pubkey) + ret = self.client.encrypt_message(address_n, pubkey, args.message) + return binascii.hexlify(ret) + + def decrypt_message(self, args): + address_n = self.client.expand_path(args.n) + pubkey = binascii.unhexlify(args.pubkey) + message = binascii.unhexlify(args.message) + ret = self.client.decrypt_message(address_n, pubkey, message, args.show_only) + return ret + def encrypt_keyvalue(self, args): address_n = self.client.expand_path(args.n) ret = self.client.encrypt_keyvalue(address_n, args.key, args.value) @@ -156,7 +169,6 @@ class Commands(object): def decrypt_keyvalue(self, args): address_n = self.client.expand_path(args.n) - value = binascii.unhexlify(args.value) ret = self.client.decrypt_keyvalue(address_n, args.key, value) return ret @@ -185,6 +197,8 @@ class Commands(object): reset_device.help = 'Perform device setup and generate new seed' sign_message.help = 'Sign message using address of given path' verify_message.help = 'Verify message' + encrypt_message.help = 'Encrypt message' + decrypt_message.help = 'Decrypt message' encrypt_keyvalue.help = 'Encrypt 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)' @@ -249,6 +263,19 @@ class Commands(object): (('message',), {'type': str}), ) + encrypt_message.arguments = ( + (('-n', '-address'), {'type': str}), + (('pubkey',), {'type': str}), + (('message',), {'type': str}), + ) + + decrypt_message.arguments = ( + (('-n', '-address'), {'type': str}), + (('pubkey',), {'type': str}), + (('message',), {'type': str}), + (('-s', '--show-only'), {'action': 'store_true', 'default': False}), + ) + verify_message.arguments = ( (('address',), {'type': str}), (('signature',), {'type': str}), diff --git a/trezorlib/client.py b/trezorlib/client.py index 949addcfa0..9c7ad37aaa 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -412,6 +412,18 @@ class ProtocolMixin(object): return True return False + @field('payload') + @expect(proto.Success) + def encrypt_message(self, n, pubkey, message): + n = self._convert_prime(n) + return self.call(proto.EncryptMessage(address_n=n, pubkey=pubkey, message=message)) + + @field('payload') + @expect(proto.Success) + def decrypt_message(self, n, pubkey, message, show_only): + n = self._convert_prime(n) + return self.call(proto.DecryptMessage(address_n=n, pubkey=pubkey, message=message, show_only=show_only)) + @field('payload') @expect(proto.Success) def encrypt_keyvalue(self, n, key, value, ask_on_encrypt=True, ask_on_decrypt=True): diff --git a/trezorlib/messages_pb2.py b/trezorlib/messages_pb2.py index 41bf17a250..b5f81def66 100644 --- a/trezorlib/messages_pb2.py +++ b/trezorlib/messages_pb2.py @@ -15,7 +15,7 @@ import types_pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='messages.proto', package='', - serialized_pb='\n\x0emessages.proto\x1a\x0btypes.proto\"\x0c\n\nInitialize\"\xcf\x02\n\x08\x46\x65\x61tures\x12\x0e\n\x06vendor\x18\x01 \x01(\t\x12\x15\n\rmajor_version\x18\x02 \x01(\r\x12\x15\n\rminor_version\x18\x03 \x01(\r\x12\x15\n\rpatch_version\x18\x04 \x01(\r\x12\x17\n\x0f\x62ootloader_mode\x18\x05 \x01(\x08\x12\x11\n\tdevice_id\x18\x06 \x01(\t\x12\x16\n\x0epin_protection\x18\x07 \x01(\x08\x12\x1d\n\x15passphrase_protection\x18\x08 \x01(\x08\x12\x10\n\x08language\x18\t \x01(\t\x12\r\n\x05label\x18\n \x01(\t\x12\x18\n\x05\x63oins\x18\x0b \x03(\x0b\x32\t.CoinType\x12\x13\n\x0binitialized\x18\x0c \x01(\x08\x12\x10\n\x08revision\x18\r \x01(\x0c\x12\x17\n\x0f\x62ootloader_hash\x18\x0e \x01(\x0c\x12\x10\n\x08imported\x18\x0f \x01(\x08\"0\n\rApplySettings\x12\x10\n\x08language\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\"\x1b\n\tChangePin\x12\x0e\n\x06remove\x18\x01 \x01(\x08\"i\n\x04Ping\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x19\n\x11\x62utton_protection\x18\x02 \x01(\x08\x12\x16\n\x0epin_protection\x18\x03 \x01(\x08\x12\x1d\n\x15passphrase_protection\x18\x04 \x01(\x08\"+\n\x07Success\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x0f\n\x07payload\x18\x02 \x01(\x0c\"6\n\x07\x46\x61ilure\x12\x1a\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0c.FailureType\x12\x0f\n\x07message\x18\x02 \x01(\t\"?\n\rButtonRequest\x12 \n\x04\x63ode\x18\x01 \x01(\x0e\x32\x12.ButtonRequestType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\"\x0b\n\tButtonAck\"7\n\x10PinMatrixRequest\x12#\n\x04type\x18\x01 \x01(\x0e\x32\x15.PinMatrixRequestType\"\x1b\n\x0cPinMatrixAck\x12\x0b\n\x03pin\x18\x01 \x02(\t\"\x08\n\x06\x43\x61ncel\"\x13\n\x11PassphraseRequest\"#\n\rPassphraseAck\x12\x12\n\npassphrase\x18\x01 \x02(\t\"\x1a\n\nGetEntropy\x12\x0c\n\x04size\x18\x01 \x02(\r\"\x1a\n\x07\x45ntropy\x12\x0f\n\x07\x65ntropy\x18\x01 \x02(\x0c\"!\n\x0cGetPublicKey\x12\x11\n\taddress_n\x18\x01 \x03(\r\"&\n\tPublicKey\x12\x19\n\x04node\x18\x01 \x02(\x0b\x32\x0b.HDNodeType\";\n\nGetAddress\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x1a\n\tcoin_name\x18\x02 \x01(\t:\x07\x42itcoin\"\x1a\n\x07\x41\x64\x64ress\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x02(\t\"\x0c\n\nWipeDevice\"\xa6\x01\n\nLoadDevice\x12\x10\n\x08mnemonic\x18\x01 \x01(\t\x12\x19\n\x04node\x18\x02 \x01(\x0b\x32\x0b.HDNodeType\x12\x0b\n\x03pin\x18\x03 \x01(\t\x12\x1d\n\x15passphrase_protection\x18\x04 \x01(\x08\x12\x19\n\x08language\x18\x05 \x01(\t:\x07\x65nglish\x12\r\n\x05label\x18\x06 \x01(\t\x12\x15\n\rskip_checksum\x18\x07 \x01(\x08\"\x9d\x01\n\x0bResetDevice\x12\x16\n\x0e\x64isplay_random\x18\x01 \x01(\x08\x12\x15\n\x08strength\x18\x02 \x01(\r:\x03\x31\x32\x38\x12\x1d\n\x15passphrase_protection\x18\x03 \x01(\x08\x12\x16\n\x0epin_protection\x18\x04 \x01(\x08\x12\x19\n\x08language\x18\x05 \x01(\t:\x07\x65nglish\x12\r\n\x05label\x18\x06 \x01(\t\"\x10\n\x0e\x45ntropyRequest\"\x1d\n\nEntropyAck\x12\x0f\n\x07\x65ntropy\x18\x01 \x01(\x0c\"\x9f\x01\n\x0eRecoveryDevice\x12\x12\n\nword_count\x18\x01 \x01(\r\x12\x1d\n\x15passphrase_protection\x18\x02 \x01(\x08\x12\x16\n\x0epin_protection\x18\x03 \x01(\x08\x12\x19\n\x08language\x18\x04 \x01(\t:\x07\x65nglish\x12\r\n\x05label\x18\x05 \x01(\t\x12\x18\n\x10\x65nforce_wordlist\x18\x06 \x01(\x08\"\r\n\x0bWordRequest\"\x17\n\x07WordAck\x12\x0c\n\x04word\x18\x01 \x02(\t\"M\n\x0bSignMessage\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x0f\n\x07message\x18\x02 \x02(\x0c\x12\x1a\n\tcoin_name\x18\x03 \x01(\t:\x07\x42itcoin\"D\n\rVerifyMessage\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x0f\n\x07message\x18\x03 \x01(\x0c\"6\n\x10MessageSignature\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\"\x80\x01\n\x0e\x43ipherKeyValue\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x0c\x12\x0f\n\x07\x65ncrypt\x18\x04 \x01(\x08\x12\x16\n\x0e\x61sk_on_encrypt\x18\x05 \x01(\x08\x12\x16\n\x0e\x61sk_on_decrypt\x18\x06 \x01(\x08\"Y\n\x0e\x45stimateTxSize\x12\x15\n\routputs_count\x18\x01 \x02(\r\x12\x14\n\x0cinputs_count\x18\x02 \x02(\r\x12\x1a\n\tcoin_name\x18\x03 \x01(\t:\x07\x42itcoin\"\x19\n\x06TxSize\x12\x0f\n\x07tx_size\x18\x01 \x01(\r\"Q\n\x06SignTx\x12\x15\n\routputs_count\x18\x01 \x02(\r\x12\x14\n\x0cinputs_count\x18\x02 \x02(\r\x12\x1a\n\tcoin_name\x18\x03 \x01(\t:\x07\x42itcoin\"\x90\x01\n\x0cSimpleSignTx\x12\x1c\n\x06inputs\x18\x01 \x03(\x0b\x32\x0c.TxInputType\x12\x1e\n\x07outputs\x18\x02 \x03(\x0b\x32\r.TxOutputType\x12&\n\x0ctransactions\x18\x03 \x03(\x0b\x32\x10.TransactionType\x12\x1a\n\tcoin_name\x18\x04 \x01(\t:\x07\x42itcoin\"\x85\x01\n\tTxRequest\x12\"\n\x0crequest_type\x18\x01 \x01(\x0e\x32\x0c.RequestType\x12&\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32\x15.TxRequestDetailsType\x12,\n\nserialized\x18\x03 \x01(\x0b\x32\x18.TxRequestSerializedType\"%\n\x05TxAck\x12\x1c\n\x02tx\x18\x01 \x01(\x0b\x32\x10.TransactionType\"\x0f\n\rFirmwareErase\"!\n\x0e\x46irmwareUpload\x12\x0f\n\x07payload\x18\x01 \x02(\x0c\"#\n\x11\x44\x65\x62ugLinkDecision\x12\x0e\n\x06yes_no\x18\x01 \x02(\x08\"\x13\n\x11\x44\x65\x62ugLinkGetState\"\xeb\x01\n\x0e\x44\x65\x62ugLinkState\x12\x0e\n\x06layout\x18\x01 \x01(\x0c\x12\x0b\n\x03pin\x18\x02 \x01(\t\x12\x0e\n\x06matrix\x18\x03 \x01(\t\x12\x10\n\x08mnemonic\x18\x04 \x01(\t\x12\x19\n\x04node\x18\x05 \x01(\x0b\x32\x0b.HDNodeType\x12\x1d\n\x15passphrase_protection\x18\x06 \x01(\x08\x12\x12\n\nreset_word\x18\x07 \x01(\t\x12\x15\n\rreset_entropy\x18\x08 \x01(\x0c\x12\x1a\n\x12recovery_fake_word\x18\t \x01(\t\x12\x19\n\x11recovery_word_pos\x18\n \x01(\r\"\x0f\n\rDebugLinkStop\";\n\x0c\x44\x65\x62ugLinkLog\x12\r\n\x05level\x18\x01 \x01(\r\x12\x0e\n\x06\x62ucket\x18\x02 \x01(\t\x12\x0c\n\x04text\x18\x03 \x01(\t*\xb1\x0c\n\x0bMessageType\x12 \n\x16MessageType_Initialize\x10\x00\x1a\x04\x90\xb5\x18\x01\x12\x1a\n\x10MessageType_Ping\x10\x01\x1a\x04\x90\xb5\x18\x01\x12\x1d\n\x13MessageType_Success\x10\x02\x1a\x04\x98\xb5\x18\x01\x12\x1d\n\x13MessageType_Failure\x10\x03\x1a\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_ChangePin\x10\x04\x1a\x04\x90\xb5\x18\x01\x12 \n\x16MessageType_WipeDevice\x10\x05\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_FirmwareErase\x10\x06\x1a\x04\x90\xb5\x18\x01\x12$\n\x1aMessageType_FirmwareUpload\x10\x07\x1a\x04\x90\xb5\x18\x01\x12 \n\x16MessageType_GetEntropy\x10\t\x1a\x04\x90\xb5\x18\x01\x12\x1d\n\x13MessageType_Entropy\x10\n\x1a\x04\x98\xb5\x18\x01\x12\"\n\x18MessageType_GetPublicKey\x10\x0b\x1a\x04\x90\xb5\x18\x01\x12\x1f\n\x15MessageType_PublicKey\x10\x0c\x1a\x04\x98\xb5\x18\x01\x12 \n\x16MessageType_LoadDevice\x10\r\x1a\x04\x90\xb5\x18\x01\x12!\n\x17MessageType_ResetDevice\x10\x0e\x1a\x04\x90\xb5\x18\x01\x12\x1c\n\x12MessageType_SignTx\x10\x0f\x1a\x04\x90\xb5\x18\x01\x12\"\n\x18MessageType_SimpleSignTx\x10\x10\x1a\x04\x90\xb5\x18\x01\x12\x1e\n\x14MessageType_Features\x10\x11\x1a\x04\x98\xb5\x18\x01\x12&\n\x1cMessageType_PinMatrixRequest\x10\x12\x1a\x04\x98\xb5\x18\x01\x12\"\n\x18MessageType_PinMatrixAck\x10\x13\x1a\x04\x90\xb5\x18\x01\x12\x1c\n\x12MessageType_Cancel\x10\x14\x1a\x04\x90\xb5\x18\x01\x12\x1f\n\x15MessageType_TxRequest\x10\x15\x1a\x04\x98\xb5\x18\x01\x12\x1b\n\x11MessageType_TxAck\x10\x16\x1a\x04\x90\xb5\x18\x01\x12$\n\x1aMessageType_CipherKeyValue\x10\x17\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_ApplySettings\x10\x19\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_ButtonRequest\x10\x1a\x1a\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_ButtonAck\x10\x1b\x1a\x04\x90\xb5\x18\x01\x12 \n\x16MessageType_GetAddress\x10\x1d\x1a\x04\x90\xb5\x18\x01\x12\x1d\n\x13MessageType_Address\x10\x1e\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_EntropyRequest\x10#\x1a\x04\x98\xb5\x18\x01\x12 \n\x16MessageType_EntropyAck\x10$\x1a\x04\x90\xb5\x18\x01\x12!\n\x17MessageType_SignMessage\x10&\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_VerifyMessage\x10\'\x1a\x04\x90\xb5\x18\x01\x12&\n\x1cMessageType_MessageSignature\x10(\x1a\x04\x98\xb5\x18\x01\x12\'\n\x1dMessageType_PassphraseRequest\x10)\x1a\x04\x98\xb5\x18\x01\x12#\n\x19MessageType_PassphraseAck\x10*\x1a\x04\x90\xb5\x18\x01\x12$\n\x1aMessageType_EstimateTxSize\x10+\x1a\x04\x90\xb5\x18\x01\x12\x1c\n\x12MessageType_TxSize\x10,\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_RecoveryDevice\x10-\x1a\x04\x90\xb5\x18\x01\x12!\n\x17MessageType_WordRequest\x10.\x1a\x04\x98\xb5\x18\x01\x12\x1d\n\x13MessageType_WordAck\x10/\x1a\x04\x90\xb5\x18\x01\x12\'\n\x1dMessageType_DebugLinkDecision\x10\x64\x1a\x04\xa0\xb5\x18\x01\x12\'\n\x1dMessageType_DebugLinkGetState\x10\x65\x1a\x04\xa0\xb5\x18\x01\x12$\n\x1aMessageType_DebugLinkState\x10\x66\x1a\x04\xa8\xb5\x18\x01\x12#\n\x19MessageType_DebugLinkStop\x10g\x1a\x04\xa0\xb5\x18\x01\x12\"\n\x18MessageType_DebugLinkLog\x10h\x1a\x04\xa8\xb5\x18\x01\x42\x30\n\x1f\x63om.satoshilabs.trezor.protobufB\rTrezorMessage') + serialized_pb='\n\x0emessages.proto\x1a\x0btypes.proto\"\x0c\n\nInitialize\"\xcf\x02\n\x08\x46\x65\x61tures\x12\x0e\n\x06vendor\x18\x01 \x01(\t\x12\x15\n\rmajor_version\x18\x02 \x01(\r\x12\x15\n\rminor_version\x18\x03 \x01(\r\x12\x15\n\rpatch_version\x18\x04 \x01(\r\x12\x17\n\x0f\x62ootloader_mode\x18\x05 \x01(\x08\x12\x11\n\tdevice_id\x18\x06 \x01(\t\x12\x16\n\x0epin_protection\x18\x07 \x01(\x08\x12\x1d\n\x15passphrase_protection\x18\x08 \x01(\x08\x12\x10\n\x08language\x18\t \x01(\t\x12\r\n\x05label\x18\n \x01(\t\x12\x18\n\x05\x63oins\x18\x0b \x03(\x0b\x32\t.CoinType\x12\x13\n\x0binitialized\x18\x0c \x01(\x08\x12\x10\n\x08revision\x18\r \x01(\x0c\x12\x17\n\x0f\x62ootloader_hash\x18\x0e \x01(\x0c\x12\x10\n\x08imported\x18\x0f \x01(\x08\"0\n\rApplySettings\x12\x10\n\x08language\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\"\x1b\n\tChangePin\x12\x0e\n\x06remove\x18\x01 \x01(\x08\"i\n\x04Ping\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x19\n\x11\x62utton_protection\x18\x02 \x01(\x08\x12\x16\n\x0epin_protection\x18\x03 \x01(\x08\x12\x1d\n\x15passphrase_protection\x18\x04 \x01(\x08\"+\n\x07Success\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x0f\n\x07payload\x18\x02 \x01(\x0c\"6\n\x07\x46\x61ilure\x12\x1a\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0c.FailureType\x12\x0f\n\x07message\x18\x02 \x01(\t\"?\n\rButtonRequest\x12 \n\x04\x63ode\x18\x01 \x01(\x0e\x32\x12.ButtonRequestType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\"\x0b\n\tButtonAck\"7\n\x10PinMatrixRequest\x12#\n\x04type\x18\x01 \x01(\x0e\x32\x15.PinMatrixRequestType\"\x1b\n\x0cPinMatrixAck\x12\x0b\n\x03pin\x18\x01 \x02(\t\"\x08\n\x06\x43\x61ncel\"\x13\n\x11PassphraseRequest\"#\n\rPassphraseAck\x12\x12\n\npassphrase\x18\x01 \x02(\t\"\x1a\n\nGetEntropy\x12\x0c\n\x04size\x18\x01 \x02(\r\"\x1a\n\x07\x45ntropy\x12\x0f\n\x07\x65ntropy\x18\x01 \x02(\x0c\"!\n\x0cGetPublicKey\x12\x11\n\taddress_n\x18\x01 \x03(\r\"&\n\tPublicKey\x12\x19\n\x04node\x18\x01 \x02(\x0b\x32\x0b.HDNodeType\";\n\nGetAddress\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x1a\n\tcoin_name\x18\x02 \x01(\t:\x07\x42itcoin\"\x1a\n\x07\x41\x64\x64ress\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x02(\t\"\x0c\n\nWipeDevice\"\xa6\x01\n\nLoadDevice\x12\x10\n\x08mnemonic\x18\x01 \x01(\t\x12\x19\n\x04node\x18\x02 \x01(\x0b\x32\x0b.HDNodeType\x12\x0b\n\x03pin\x18\x03 \x01(\t\x12\x1d\n\x15passphrase_protection\x18\x04 \x01(\x08\x12\x19\n\x08language\x18\x05 \x01(\t:\x07\x65nglish\x12\r\n\x05label\x18\x06 \x01(\t\x12\x15\n\rskip_checksum\x18\x07 \x01(\x08\"\x9d\x01\n\x0bResetDevice\x12\x16\n\x0e\x64isplay_random\x18\x01 \x01(\x08\x12\x15\n\x08strength\x18\x02 \x01(\r:\x03\x31\x32\x38\x12\x1d\n\x15passphrase_protection\x18\x03 \x01(\x08\x12\x16\n\x0epin_protection\x18\x04 \x01(\x08\x12\x19\n\x08language\x18\x05 \x01(\t:\x07\x65nglish\x12\r\n\x05label\x18\x06 \x01(\t\"\x10\n\x0e\x45ntropyRequest\"\x1d\n\nEntropyAck\x12\x0f\n\x07\x65ntropy\x18\x01 \x01(\x0c\"\x9f\x01\n\x0eRecoveryDevice\x12\x12\n\nword_count\x18\x01 \x01(\r\x12\x1d\n\x15passphrase_protection\x18\x02 \x01(\x08\x12\x16\n\x0epin_protection\x18\x03 \x01(\x08\x12\x19\n\x08language\x18\x04 \x01(\t:\x07\x65nglish\x12\r\n\x05label\x18\x05 \x01(\t\x12\x18\n\x10\x65nforce_wordlist\x18\x06 \x01(\x08\"\r\n\x0bWordRequest\"\x17\n\x07WordAck\x12\x0c\n\x04word\x18\x01 \x02(\t\"M\n\x0bSignMessage\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x0f\n\x07message\x18\x02 \x02(\x0c\x12\x1a\n\tcoin_name\x18\x03 \x01(\t:\x07\x42itcoin\"D\n\rVerifyMessage\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x0f\n\x07message\x18\x03 \x01(\x0c\"6\n\x10MessageSignature\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\"D\n\x0e\x45ncryptMessage\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x0e\n\x06pubkey\x18\x02 \x01(\x0c\x12\x0f\n\x07message\x18\x03 \x01(\x0c\"W\n\x0e\x44\x65\x63ryptMessage\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x0e\n\x06pubkey\x18\x02 \x01(\x0c\x12\x0f\n\x07message\x18\x03 \x01(\x0c\x12\x11\n\tshow_only\x18\x04 \x01(\x08\"\x80\x01\n\x0e\x43ipherKeyValue\x12\x11\n\taddress_n\x18\x01 \x03(\r\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x0c\x12\x0f\n\x07\x65ncrypt\x18\x04 \x01(\x08\x12\x16\n\x0e\x61sk_on_encrypt\x18\x05 \x01(\x08\x12\x16\n\x0e\x61sk_on_decrypt\x18\x06 \x01(\x08\"Y\n\x0e\x45stimateTxSize\x12\x15\n\routputs_count\x18\x01 \x02(\r\x12\x14\n\x0cinputs_count\x18\x02 \x02(\r\x12\x1a\n\tcoin_name\x18\x03 \x01(\t:\x07\x42itcoin\"\x19\n\x06TxSize\x12\x0f\n\x07tx_size\x18\x01 \x01(\r\"Q\n\x06SignTx\x12\x15\n\routputs_count\x18\x01 \x02(\r\x12\x14\n\x0cinputs_count\x18\x02 \x02(\r\x12\x1a\n\tcoin_name\x18\x03 \x01(\t:\x07\x42itcoin\"\x90\x01\n\x0cSimpleSignTx\x12\x1c\n\x06inputs\x18\x01 \x03(\x0b\x32\x0c.TxInputType\x12\x1e\n\x07outputs\x18\x02 \x03(\x0b\x32\r.TxOutputType\x12&\n\x0ctransactions\x18\x03 \x03(\x0b\x32\x10.TransactionType\x12\x1a\n\tcoin_name\x18\x04 \x01(\t:\x07\x42itcoin\"\x85\x01\n\tTxRequest\x12\"\n\x0crequest_type\x18\x01 \x01(\x0e\x32\x0c.RequestType\x12&\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32\x15.TxRequestDetailsType\x12,\n\nserialized\x18\x03 \x01(\x0b\x32\x18.TxRequestSerializedType\"%\n\x05TxAck\x12\x1c\n\x02tx\x18\x01 \x01(\x0b\x32\x10.TransactionType\"\x0f\n\rFirmwareErase\"!\n\x0e\x46irmwareUpload\x12\x0f\n\x07payload\x18\x01 \x02(\x0c\"#\n\x11\x44\x65\x62ugLinkDecision\x12\x0e\n\x06yes_no\x18\x01 \x02(\x08\"\x13\n\x11\x44\x65\x62ugLinkGetState\"\xeb\x01\n\x0e\x44\x65\x62ugLinkState\x12\x0e\n\x06layout\x18\x01 \x01(\x0c\x12\x0b\n\x03pin\x18\x02 \x01(\t\x12\x0e\n\x06matrix\x18\x03 \x01(\t\x12\x10\n\x08mnemonic\x18\x04 \x01(\t\x12\x19\n\x04node\x18\x05 \x01(\x0b\x32\x0b.HDNodeType\x12\x1d\n\x15passphrase_protection\x18\x06 \x01(\x08\x12\x12\n\nreset_word\x18\x07 \x01(\t\x12\x15\n\rreset_entropy\x18\x08 \x01(\x0c\x12\x1a\n\x12recovery_fake_word\x18\t \x01(\t\x12\x19\n\x11recovery_word_pos\x18\n \x01(\r\"\x0f\n\rDebugLinkStop\";\n\x0c\x44\x65\x62ugLinkLog\x12\r\n\x05level\x18\x01 \x01(\r\x12\x0e\n\x06\x62ucket\x18\x02 \x01(\t\x12\x0c\n\x04text\x18\x03 \x01(\t*\xfd\x0c\n\x0bMessageType\x12 \n\x16MessageType_Initialize\x10\x00\x1a\x04\x90\xb5\x18\x01\x12\x1a\n\x10MessageType_Ping\x10\x01\x1a\x04\x90\xb5\x18\x01\x12\x1d\n\x13MessageType_Success\x10\x02\x1a\x04\x98\xb5\x18\x01\x12\x1d\n\x13MessageType_Failure\x10\x03\x1a\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_ChangePin\x10\x04\x1a\x04\x90\xb5\x18\x01\x12 \n\x16MessageType_WipeDevice\x10\x05\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_FirmwareErase\x10\x06\x1a\x04\x90\xb5\x18\x01\x12$\n\x1aMessageType_FirmwareUpload\x10\x07\x1a\x04\x90\xb5\x18\x01\x12 \n\x16MessageType_GetEntropy\x10\t\x1a\x04\x90\xb5\x18\x01\x12\x1d\n\x13MessageType_Entropy\x10\n\x1a\x04\x98\xb5\x18\x01\x12\"\n\x18MessageType_GetPublicKey\x10\x0b\x1a\x04\x90\xb5\x18\x01\x12\x1f\n\x15MessageType_PublicKey\x10\x0c\x1a\x04\x98\xb5\x18\x01\x12 \n\x16MessageType_LoadDevice\x10\r\x1a\x04\x90\xb5\x18\x01\x12!\n\x17MessageType_ResetDevice\x10\x0e\x1a\x04\x90\xb5\x18\x01\x12\x1c\n\x12MessageType_SignTx\x10\x0f\x1a\x04\x90\xb5\x18\x01\x12\"\n\x18MessageType_SimpleSignTx\x10\x10\x1a\x04\x90\xb5\x18\x01\x12\x1e\n\x14MessageType_Features\x10\x11\x1a\x04\x98\xb5\x18\x01\x12&\n\x1cMessageType_PinMatrixRequest\x10\x12\x1a\x04\x98\xb5\x18\x01\x12\"\n\x18MessageType_PinMatrixAck\x10\x13\x1a\x04\x90\xb5\x18\x01\x12\x1c\n\x12MessageType_Cancel\x10\x14\x1a\x04\x90\xb5\x18\x01\x12\x1f\n\x15MessageType_TxRequest\x10\x15\x1a\x04\x98\xb5\x18\x01\x12\x1b\n\x11MessageType_TxAck\x10\x16\x1a\x04\x90\xb5\x18\x01\x12$\n\x1aMessageType_CipherKeyValue\x10\x17\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_ApplySettings\x10\x19\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_ButtonRequest\x10\x1a\x1a\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_ButtonAck\x10\x1b\x1a\x04\x90\xb5\x18\x01\x12 \n\x16MessageType_GetAddress\x10\x1d\x1a\x04\x90\xb5\x18\x01\x12\x1d\n\x13MessageType_Address\x10\x1e\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_EntropyRequest\x10#\x1a\x04\x98\xb5\x18\x01\x12 \n\x16MessageType_EntropyAck\x10$\x1a\x04\x90\xb5\x18\x01\x12!\n\x17MessageType_SignMessage\x10&\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_VerifyMessage\x10\'\x1a\x04\x90\xb5\x18\x01\x12&\n\x1cMessageType_MessageSignature\x10(\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_EncryptMessage\x10\x30\x1a\x04\x90\xb5\x18\x01\x12$\n\x1aMessageType_DecryptMessage\x10\x31\x1a\x04\x90\xb5\x18\x01\x12\'\n\x1dMessageType_PassphraseRequest\x10)\x1a\x04\x98\xb5\x18\x01\x12#\n\x19MessageType_PassphraseAck\x10*\x1a\x04\x90\xb5\x18\x01\x12$\n\x1aMessageType_EstimateTxSize\x10+\x1a\x04\x90\xb5\x18\x01\x12\x1c\n\x12MessageType_TxSize\x10,\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_RecoveryDevice\x10-\x1a\x04\x90\xb5\x18\x01\x12!\n\x17MessageType_WordRequest\x10.\x1a\x04\x98\xb5\x18\x01\x12\x1d\n\x13MessageType_WordAck\x10/\x1a\x04\x90\xb5\x18\x01\x12\'\n\x1dMessageType_DebugLinkDecision\x10\x64\x1a\x04\xa0\xb5\x18\x01\x12\'\n\x1dMessageType_DebugLinkGetState\x10\x65\x1a\x04\xa0\xb5\x18\x01\x12$\n\x1aMessageType_DebugLinkState\x10\x66\x1a\x04\xa8\xb5\x18\x01\x12#\n\x19MessageType_DebugLinkStop\x10g\x1a\x04\xa0\xb5\x18\x01\x12\"\n\x18MessageType_DebugLinkLog\x10h\x1a\x04\xa8\xb5\x18\x01\x42\x30\n\x1f\x63om.satoshilabs.trezor.protobufB\rTrezorMessage') _MESSAGETYPE = _descriptor.EnumDescriptor( name='MessageType', @@ -156,58 +156,66 @@ _MESSAGETYPE = _descriptor.EnumDescriptor( options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\230\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_PassphraseRequest', index=33, number=41, + name='MessageType_EncryptMessage', index=33, number=48, + options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001'), + type=None), + _descriptor.EnumValueDescriptor( + name='MessageType_DecryptMessage', index=34, number=49, + options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001'), + type=None), + _descriptor.EnumValueDescriptor( + name='MessageType_PassphraseRequest', index=35, number=41, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\230\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_PassphraseAck', index=34, number=42, + name='MessageType_PassphraseAck', index=36, number=42, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_EstimateTxSize', index=35, number=43, + name='MessageType_EstimateTxSize', index=37, number=43, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_TxSize', index=36, number=44, + name='MessageType_TxSize', index=38, number=44, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\230\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_RecoveryDevice', index=37, number=45, + name='MessageType_RecoveryDevice', index=39, number=45, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_WordRequest', index=38, number=46, + name='MessageType_WordRequest', index=40, number=46, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\230\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_WordAck', index=39, number=47, + name='MessageType_WordAck', index=41, number=47, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkDecision', index=40, number=100, + name='MessageType_DebugLinkDecision', index=42, number=100, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\240\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkGetState', index=41, number=101, + name='MessageType_DebugLinkGetState', index=43, number=101, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\240\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkState', index=42, number=102, + name='MessageType_DebugLinkState', index=44, number=102, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\250\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkStop', index=43, number=103, + name='MessageType_DebugLinkStop', index=45, number=103, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\240\265\030\001'), type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkLog', index=44, number=104, + name='MessageType_DebugLinkLog', index=46, number=104, options=_descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\250\265\030\001'), type=None), ], containing_type=None, options=None, - serialized_start=3002, - serialized_end=4587, + serialized_start=3161, + serialized_end=4822, ) MessageType = enum_type_wrapper.EnumTypeWrapper(_MESSAGETYPE) @@ -244,6 +252,8 @@ MessageType_EntropyAck = 36 MessageType_SignMessage = 38 MessageType_VerifyMessage = 39 MessageType_MessageSignature = 40 +MessageType_EncryptMessage = 48 +MessageType_DecryptMessage = 49 MessageType_PassphraseRequest = 41 MessageType_PassphraseAck = 42 MessageType_EstimateTxSize = 43 @@ -1379,6 +1389,97 @@ _MESSAGESIGNATURE = _descriptor.Descriptor( ) +_ENCRYPTMESSAGE = _descriptor.Descriptor( + name='EncryptMessage', + full_name='EncryptMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='address_n', full_name='EncryptMessage.address_n', index=0, + number=1, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pubkey', full_name='EncryptMessage.pubkey', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value="", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='message', full_name='EncryptMessage.message', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value="", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=1921, + serialized_end=1989, +) + + +_DECRYPTMESSAGE = _descriptor.Descriptor( + name='DecryptMessage', + full_name='DecryptMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='address_n', full_name='DecryptMessage.address_n', index=0, + number=1, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pubkey', full_name='DecryptMessage.pubkey', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value="", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='message', full_name='DecryptMessage.message', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value="", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='show_only', full_name='DecryptMessage.show_only', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=1991, + serialized_end=2078, +) + + _CIPHERKEYVALUE = _descriptor.Descriptor( name='CipherKeyValue', full_name='CipherKeyValue', @@ -1437,8 +1538,8 @@ _CIPHERKEYVALUE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=1922, - serialized_end=2050, + serialized_start=2081, + serialized_end=2209, ) @@ -1479,8 +1580,8 @@ _ESTIMATETXSIZE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2052, - serialized_end=2141, + serialized_start=2211, + serialized_end=2300, ) @@ -1507,8 +1608,8 @@ _TXSIZE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2143, - serialized_end=2168, + serialized_start=2302, + serialized_end=2327, ) @@ -1549,8 +1650,8 @@ _SIGNTX = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2170, - serialized_end=2251, + serialized_start=2329, + serialized_end=2410, ) @@ -1598,8 +1699,8 @@ _SIMPLESIGNTX = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2254, - serialized_end=2398, + serialized_start=2413, + serialized_end=2557, ) @@ -1640,8 +1741,8 @@ _TXREQUEST = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2401, - serialized_end=2534, + serialized_start=2560, + serialized_end=2693, ) @@ -1668,8 +1769,8 @@ _TXACK = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2536, - serialized_end=2573, + serialized_start=2695, + serialized_end=2732, ) @@ -1689,8 +1790,8 @@ _FIRMWAREERASE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2575, - serialized_end=2590, + serialized_start=2734, + serialized_end=2749, ) @@ -1717,8 +1818,8 @@ _FIRMWAREUPLOAD = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2592, - serialized_end=2625, + serialized_start=2751, + serialized_end=2784, ) @@ -1745,8 +1846,8 @@ _DEBUGLINKDECISION = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2627, - serialized_end=2662, + serialized_start=2786, + serialized_end=2821, ) @@ -1766,8 +1867,8 @@ _DEBUGLINKGETSTATE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2664, - serialized_end=2683, + serialized_start=2823, + serialized_end=2842, ) @@ -1857,8 +1958,8 @@ _DEBUGLINKSTATE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2686, - serialized_end=2921, + serialized_start=2845, + serialized_end=3080, ) @@ -1878,8 +1979,8 @@ _DEBUGLINKSTOP = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2923, - serialized_end=2938, + serialized_start=3082, + serialized_end=3097, ) @@ -1920,8 +2021,8 @@ _DEBUGLINKLOG = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2940, - serialized_end=2999, + serialized_start=3099, + serialized_end=3158, ) _FEATURES.fields_by_name['coins'].message_type = types_pb2._COINTYPE @@ -1969,6 +2070,8 @@ DESCRIPTOR.message_types_by_name['WordAck'] = _WORDACK DESCRIPTOR.message_types_by_name['SignMessage'] = _SIGNMESSAGE DESCRIPTOR.message_types_by_name['VerifyMessage'] = _VERIFYMESSAGE DESCRIPTOR.message_types_by_name['MessageSignature'] = _MESSAGESIGNATURE +DESCRIPTOR.message_types_by_name['EncryptMessage'] = _ENCRYPTMESSAGE +DESCRIPTOR.message_types_by_name['DecryptMessage'] = _DECRYPTMESSAGE DESCRIPTOR.message_types_by_name['CipherKeyValue'] = _CIPHERKEYVALUE DESCRIPTOR.message_types_by_name['EstimateTxSize'] = _ESTIMATETXSIZE DESCRIPTOR.message_types_by_name['TxSize'] = _TXSIZE @@ -2170,6 +2273,18 @@ class MessageSignature(_message.Message): # @@protoc_insertion_point(class_scope:MessageSignature) +class EncryptMessage(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _ENCRYPTMESSAGE + + # @@protoc_insertion_point(class_scope:EncryptMessage) + +class DecryptMessage(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _DECRYPTMESSAGE + + # @@protoc_insertion_point(class_scope:DecryptMessage) + class CipherKeyValue(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType DESCRIPTOR = _CIPHERKEYVALUE @@ -2323,6 +2438,10 @@ _MESSAGETYPE.values_by_name["MessageType_VerifyMessage"].has_options = True _MESSAGETYPE.values_by_name["MessageType_VerifyMessage"]._options = _descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001') _MESSAGETYPE.values_by_name["MessageType_MessageSignature"].has_options = True _MESSAGETYPE.values_by_name["MessageType_MessageSignature"]._options = _descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\230\265\030\001') +_MESSAGETYPE.values_by_name["MessageType_EncryptMessage"].has_options = True +_MESSAGETYPE.values_by_name["MessageType_EncryptMessage"]._options = _descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001') +_MESSAGETYPE.values_by_name["MessageType_DecryptMessage"].has_options = True +_MESSAGETYPE.values_by_name["MessageType_DecryptMessage"]._options = _descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\220\265\030\001') _MESSAGETYPE.values_by_name["MessageType_PassphraseRequest"].has_options = True _MESSAGETYPE.values_by_name["MessageType_PassphraseRequest"]._options = _descriptor._ParseOptions(descriptor_pb2.EnumValueOptions(), '\230\265\030\001') _MESSAGETYPE.values_by_name["MessageType_PassphraseAck"].has_options = True