xref: /aosp_15_r20/external/tink/java_src/proto/ecdsa.proto (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1// Copyright 2017 Google Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15////////////////////////////////////////////////////////////////////////////////
16
17// Definitions for Elliptic Curve Digital Signature Algorithm (ECDSA).
18syntax = "proto3";
19
20package google.crypto.tink;
21
22import "proto/common.proto";
23
24option java_package = "com.google.crypto.tink.proto";
25option java_multiple_files = true;
26option go_package = "github.com/google/tink/go/proto/ecdsa_go_proto";
27
28enum EcdsaSignatureEncoding {
29  UNKNOWN_ENCODING = 0;
30  // The signature's format is r || s, where r and s are zero-padded and have
31  // the same size in bytes as the order of the curve. For example, for NIST
32  // P-256 curve, r and s are zero-padded to 32 bytes.
33  IEEE_P1363 = 1;
34  // The signature is encoded using ASN.1
35  // (https://tools.ietf.org/html/rfc5480#appendix-A):
36  // ECDSA-Sig-Value :: = SEQUENCE {
37  //  r INTEGER,
38  //  s INTEGER
39  // }
40  DER = 2;
41}
42
43// Protos for Ecdsa.
44message EcdsaParams {
45  // Required.
46  HashType hash_type = 1;
47  // Required.
48  EllipticCurveType curve = 2;
49  // Required.
50  EcdsaSignatureEncoding encoding = 3;
51}
52
53// key_type: type.googleapis.com/google.crypto.tink.EcdsaPublicKey
54message EcdsaPublicKey {
55  // Required.
56  uint32 version = 1;
57  // Required.
58  EcdsaParams params = 2;
59  // Affine coordinates of the public key in bigendian representation. The
60  // public key is a point (x, y) on the curve defined by params.curve. For
61  // ECDH, it is crucial to verify whether the public key point (x, y) is on the
62  // private's key curve. For ECDSA, such verification is a defense in depth.
63  // Required.
64  bytes x = 3;
65  // Required.
66  bytes y = 4;
67}
68
69// key_type: type.googleapis.com/google.crypto.tink.EcdsaPrivateKey
70message EcdsaPrivateKey {
71  // Required.
72  uint32 version = 1;
73  // Required.
74  EcdsaPublicKey public_key = 2;
75  // Unsigned big integer in bigendian representation.
76  // Required.
77  bytes key_value = 3;
78}
79
80message EcdsaKeyFormat {
81  // Required.
82  EcdsaParams params = 2;
83  uint32 version = 3;
84}
85