-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypto.proto
42 lines (34 loc) · 1.09 KB
/
crypto.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// TODO(Someone): copyright
syntax = "proto3";
package crypto;
enum Type {
UNKNOWN = 0;
P256 = 1;
}
// DO NOT modify its field directly, object of this class is immutable
message PublicKey256 {
bytes data = 1; // 256 bits long
}
// DO NOT modify its field directly, object of this class is immutable
message PrivateKey {
Type type = 1;
bytes data = 2; // for ecdsa, this is the random number k
}
// DO NOT modify its field directly, object of this class is immutable
//
// TODO: signature compression
// Note for ECDSA compression:
// 1. secp256k1 implementation: https://github.com/ethereum/go-ethereum/tree/develop/crypto/secp256k1
// 2. <x, y> can be stored as <x, first_bit_of_y>
// 3. if h == 1 (e.g. secp256k1), r == s. For more about how to recover <x, y> from <r, s>, read http://www.secg.org/sec1-v2.pdf, page 47-48
message Signature {
Type type = 1;
bytes data = 2; // for ecdsa, this is <r, s, x, y> (for now).
}
// DO NOT modify its field directly, object of this class is immutable
message Digest256 {
bytes data = 1;
}
message Digests256 {
repeated Digest256 digests = 1;
}