From b0d84af06fc92dacd16fdaca32d3d58be464be1e Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 12 Jun 2014 16:01:31 +0200 Subject: [PATCH] add EncryptMessage and DecryptMessage --- protob/messages.proto | 31 ++++++++++++++++++++++++++++--- protob/types.proto | 8 +++++--- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/protob/messages.proto b/protob/messages.proto index c486e770dd..67eb82d3e8 100644 --- a/protob/messages.proto +++ b/protob/messages.proto @@ -48,6 +48,8 @@ enum MessageType { MessageType_SignMessage = 38 [(wire_in) = true]; MessageType_VerifyMessage = 39 [(wire_in) = true]; MessageType_MessageSignature = 40 [(wire_out) = true]; + MessageType_EncryptMessage = 48 [(wire_in) = true]; + MessageType_DecryptMessage = 49 [(wire_in) = true]; MessageType_PassphraseRequest = 41 [(wire_out) = true]; MessageType_PassphraseAck = 42 [(wire_in) = true]; MessageType_EstimateTxSize = 43 [(wire_in) = true]; @@ -384,15 +386,38 @@ message MessageSignature { // Encryption/decryption // /////////////////////////// +/** + * Request: Ask device to encrypt message + * @next Success + * @next Failure + */ +message EncryptMessage { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional bytes pubkey = 2; // public key + optional bytes message = 3; // message to encrypt +} + +/** + * Request: Ask device to decrypt message + * @next Success + * @next Failure + */ +message DecryptMessage { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional bytes pubkey = 2; // public key + optional bytes message = 3; // message to decrypt + optional bool show_only = 4; // show just on display? (don't send back via wire) +} + /** * Request: Ask device to encrypt or decrypt value of given key * @next Success * @next Failure */ message CipherKeyValue { - repeated uint32 address_n = 1; - optional string key = 2; - optional bytes value = 3; + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional string key = 2; // key component of key:value + optional bytes value = 3; // value component of key:value optional bool encrypt = 4; // are we encrypting (True) or decrypting (False)? optional bool ask_on_encrypt = 5; // should we ask on encrypt operation? optional bool ask_on_decrypt = 6; // should we ask on decrypt operation? diff --git a/protob/types.proto b/protob/types.proto index 75a37fb310..e0ee627822 100644 --- a/protob/types.proto +++ b/protob/types.proto @@ -122,7 +122,7 @@ message CoinType { optional uint64 maxfee_kb = 4; } -/* +/** * Type of redeem script used in input * @used_in TxInputType */ @@ -181,7 +181,8 @@ message TransactionType { optional uint32 outputs_cnt = 7; } -/* +/** + * Structure representing request details * @used_in TxRequest */ message TxRequestDetailsType { @@ -189,7 +190,8 @@ message TxRequestDetailsType { optional bytes tx_hash = 2; // tx_hash of requested transaction } -/* +/** + * Structure representing serialized data * @used_in TxRequest */ message TxRequestSerializedType {