xref: /aosp_15_r20/external/tink/go/signature/subtle/subtle_test.go (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1// Copyright 2020 Google LLC
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
17package subtle_test
18
19import "github.com/google/tink/go/testutil"
20
21type ecdsaSuite struct {
22	testutil.WycheproofSuite
23	TestGroups []*ecdsaGroup `json:"testGroups"`
24}
25
26type ecdsaGroup struct {
27	testutil.WycheproofGroup
28	JWK    *ecdsaJWK     `json:"jwk,omitempty"`
29	KeyDER string        `json:"keyDer"`
30	KeyPEM string        `json:"keyPem"`
31	SHA    string        `json:"sha"`
32	Type   string        `json:"type"`
33	Key    *ecdsaTestKey `json:"key"`
34	Tests  []*ecdsaCase  `json:"tests"`
35}
36
37type ecdsaCase struct {
38	testutil.WycheproofCase
39	Message   testutil.HexBytes `json:"msg"`
40	Signature testutil.HexBytes `json:"sig"`
41}
42
43type ecdsaTestKey struct {
44	Curve string `json:"curve"`
45	Type  string `json:"type"`
46	Wx    string `json:"wx"`
47	Wy    string `json:"wy"`
48}
49
50type ecdsaJWK struct {
51	JWK   string `json:"jwk"`
52	Curve string `json:"crv"`
53	Kid   string `json:"kid"`
54	Kty   string `json:"kty"`
55	X     string `json:"x"`
56	Y     string `json:"y"`
57}
58
59type ed25519Suite struct {
60	testutil.WycheproofSuite
61	TestGroups []*ed25519Group `json:"testGroups"`
62}
63
64type ed25519Group struct {
65	testutil.WycheproofGroup
66	KeyDER string          `json:"keyDer"`
67	KeyPEM string          `json:"keyPem"`
68	SHA    string          `json:"sha"`
69	Type   string          `json:"type"`
70	Key    *ed25519TestKey `json:"key"`
71	Tests  []*ed25519Case  `json:"tests"`
72}
73
74type ed25519Case struct {
75	testutil.WycheproofCase
76	Message   testutil.HexBytes `json:"msg"`
77	Signature testutil.HexBytes `json:"sig"`
78}
79
80type ed25519TestKey struct {
81	SK testutil.HexBytes `json:"sk"`
82	PK testutil.HexBytes `json:"pk"`
83}
84