2018-07-04 14:44:26 +00:00
syntax = "proto2" ;
2018-07-29 14:17:00 +00:00
package hw . trezor.messages.crypto ;
2018-07-04 14:44:26 +00:00
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf" ;
option java_outer_classname = "TrezorMessageCrypto" ;
2021-09-27 22:42:28 +00:00
option ( include_in_bitcoin_only ) = true ;
import "messages.proto" ;
2018-07-04 14:44:26 +00:00
/ * *
* Request : Ask device to encrypt or decrypt value of given key
2018-07-16 14:51:03 +00:00
* @ start
2018-07-04 14:44:26 +00:00
* @ next CipheredKeyValue
* @ next Failure
* /
message CipherKeyValue {
repeated uint32 address_n = 1 ; // BIP-32 path to derive the key from master node
2021-01-08 11:12:33 +00:00
required string key = 2 ; // key component of key:value
required bytes value = 3 ; // value component of key:value
2018-07-04 14:44:26 +00:00
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?
optional bytes iv = 7 ; // initialization vector (will be computed if not set)
}
/ * *
* Response : Return ciphered / deciphered value
2018-07-16 14:51:03 +00:00
* @ end
2018-07-04 14:44:26 +00:00
* /
message CipheredKeyValue {
2021-01-08 11:12:33 +00:00
required bytes value = 1 ; // ciphered/deciphered value
2018-07-04 14:44:26 +00:00
}
/ * *
2018-07-16 14:51:03 +00:00
* Structure representing identity data
* @ embed
* /
2018-07-04 14:44:26 +00:00
message IdentityType {
optional string proto = 1 ; // proto part of URI
optional string user = 2 ; // user part of URI
optional string host = 3 ; // host part of URI
optional string port = 4 ; // port part of URI
optional string path = 5 ; // path part of URI
optional uint32 index = 6 [ default = 0 ] ; // identity index
}
/ * *
* Request : Ask device to sign identity
2018-07-16 14:51:03 +00:00
* @ start
2018-07-04 14:44:26 +00:00
* @ next SignedIdentity
* @ next Failure
* /
message SignIdentity {
2021-01-08 11:12:33 +00:00
required IdentityType identity = 1 ; // identity
optional bytes challenge_hidden = 2 [ default = "" ] ; // non-visible challenge
optional string challenge_visual = 3 [ default = "" ] ; // challenge shown on display (e.g. date+time)
optional string ecdsa_curve_name = 4 ; // ECDSA curve name to use
2018-07-04 14:44:26 +00:00
}
/ * *
* Response : Device provides signed identity
2018-07-16 14:51:03 +00:00
* @ end
2018-07-04 14:44:26 +00:00
* /
message SignedIdentity {
optional string address = 1 ; // identity address
2021-01-08 11:12:33 +00:00
required bytes public_key = 2 ; // identity public key
required bytes signature = 3 ; // signature of the identity data
2018-07-04 14:44:26 +00:00
}
/ * *
* Request : Ask device to generate ECDH session key
2018-07-16 14:51:03 +00:00
* @ start
2018-07-04 14:44:26 +00:00
* @ next ECDHSessionKey
* @ next Failure
* /
message GetECDHSessionKey {
2021-01-08 11:12:33 +00:00
required IdentityType identity = 1 ; // identity
required bytes peer_public_key = 2 ; // peer's public key
2018-07-04 14:44:26 +00:00
optional string ecdsa_curve_name = 3 ; // ECDSA curve name to use
}
/ * *
* Response : Device provides ECDH session key
2018-07-16 14:51:03 +00:00
* @ end
2018-07-04 14:44:26 +00:00
* /
message ECDHSessionKey {
2021-01-08 11:12:33 +00:00
required bytes session_key = 1 ; // ECDH session key
2021-03-02 08:57:00 +00:00
optional bytes public_key = 2 ; // identity public key
2018-07-04 14:44:26 +00:00
}
/ * *
* Request : Ask device to commit to CoSi signing
2018-07-16 14:51:03 +00:00
* @ start
2018-07-04 14:44:26 +00:00
* @ next CosiCommitment
* @ next Failure
* /
message CosiCommit {
2022-06-23 07:27:48 +00:00
repeated uint32 address_n = 1 ; // BIP-32 path to derive the key from master node
optional bytes data = 2 [ deprecated = true ] ; // Data to be signed. Deprecated in 1.10.2, the field is not needed, since CoSi commitments are no longer deterministic.
2018-07-04 14:44:26 +00:00
}
/ * *
* Response : Contains a CoSi commitment
2018-07-16 14:51:03 +00:00
* @ end
2018-07-04 14:44:26 +00:00
* /
message CosiCommitment {
optional bytes commitment = 1 ; // Commitment
optional bytes pubkey = 2 ; // Public key
}
/ * *
* Request : Ask device to sign using CoSi
2018-07-16 14:51:03 +00:00
* @ start
2018-07-04 14:44:26 +00:00
* @ next CosiSignature
* @ next Failure
* /
message CosiSign {
repeated uint32 address_n = 1 ; // BIP-32 path to derive the key from master node
optional bytes data = 2 ; // Data to be signed
optional bytes global_commitment = 3 ; // Aggregated commitment
optional bytes global_pubkey = 4 ; // Aggregated public key
}
/ * *
* Response : Contains a CoSi signature
2018-07-16 14:51:03 +00:00
* @ end
2018-07-04 14:44:26 +00:00
* /
message CosiSignature {
2021-01-14 11:05:03 +00:00
required bytes signature = 1 ; // Signature
2018-07-04 14:44:26 +00:00
}