@@ -11,7 +11,7 @@ import (
11
11
func TestEccNITSP256 (t * testing.T ) {
12
12
data := []byte {0x08 , 0x2a , 0x86 , 0x48 , 0xce , 0x3d , 0x03 , 0x01 , 0x07 }
13
13
dump := "2a 86 48 ce 3d 03 01 07"
14
- note := "NIST P-256 "
14
+ note := "nistp256 "
15
15
reader := reader .New (data )
16
16
oid , err := NewOID (reader )
17
17
if err != nil {
@@ -35,7 +35,7 @@ func TestEccNITSP256(t *testing.T) {
35
35
func TestEccNITSP384 (t * testing.T ) {
36
36
data := []byte {0x05 , 0x2b , 0x81 , 0x04 , 0x00 , 0x22 }
37
37
dump := "2b 81 04 00 22"
38
- note := "NIST P-384 "
38
+ note := "nistp384 "
39
39
reader := reader .New (data )
40
40
oid , err := NewOID (reader )
41
41
if err != nil {
@@ -59,7 +59,151 @@ func TestEccNITSP384(t *testing.T) {
59
59
func TestEccNITSP521 (t * testing.T ) {
60
60
data := []byte {0x05 , 0x2b , 0x81 , 0x04 , 0x00 , 0x23 }
61
61
dump := "2b 81 04 00 23"
62
- note := "NIST P-521"
62
+ note := "nistp521"
63
+ reader := reader .New (data )
64
+ oid , err := NewOID (reader )
65
+ if err != nil {
66
+ t .Errorf ("OID = \" %v\" , want nil." , err .Error ())
67
+ }
68
+ i := oid .ToItem (true )
69
+ if i .Name != "ECC OID" {
70
+ t .Errorf ("OID.Name = \" %v\" , want \" ECC OID\" ." , i .Name )
71
+ }
72
+ if i .Value != note {
73
+ t .Errorf ("OID.Value = \" %v\" , want \" %s\" " , i .Value , note )
74
+ }
75
+ if i .Note != "" {
76
+ t .Errorf ("OID.Note = \" %v\" , want \" \" ." , i .Note )
77
+ }
78
+ if i .Dump != dump {
79
+ t .Errorf ("OIS.Dump = \" %v\" , want \" %s\" ." , i .Dump , dump )
80
+ }
81
+ }
82
+
83
+ func TestEccSecp256k1 (t * testing.T ) {
84
+ data := []byte {0x05 , 0x2b , 0x81 , 0x04 , 0x00 , 0x0a }
85
+ dump := "2b 81 04 00 0a"
86
+ note := "secp256k1"
87
+ reader := reader .New (data )
88
+ oid , err := NewOID (reader )
89
+ if err != nil {
90
+ t .Errorf ("OID = \" %v\" , want nil." , err .Error ())
91
+ }
92
+ i := oid .ToItem (true )
93
+ if i .Name != "ECC OID" {
94
+ t .Errorf ("OID.Name = \" %v\" , want \" ECC OID\" ." , i .Name )
95
+ }
96
+ if i .Value != note {
97
+ t .Errorf ("OID.Value = \" %v\" , want \" %s\" " , i .Value , note )
98
+ }
99
+ if i .Note != "" {
100
+ t .Errorf ("OID.Note = \" %v\" , want \" \" ." , i .Note )
101
+ }
102
+ if i .Dump != dump {
103
+ t .Errorf ("OIS.Dump = \" %v\" , want \" %s\" ." , i .Dump , dump )
104
+ }
105
+ }
106
+
107
+ func TestEccBrainpoolP256r1 (t * testing.T ) {
108
+ data := []byte {0x09 , 0x2B , 0x24 , 0x03 , 0x03 , 0x02 , 0x08 , 0x01 , 0x01 , 0x07 }
109
+ dump := "2b 24 03 03 02 08 01 01 07"
110
+ note := "brainpoolP256r1"
111
+ reader := reader .New (data )
112
+ oid , err := NewOID (reader )
113
+ if err != nil {
114
+ t .Errorf ("OID = \" %v\" , want nil." , err .Error ())
115
+ }
116
+ i := oid .ToItem (true )
117
+ if i .Name != "ECC OID" {
118
+ t .Errorf ("OID.Name = \" %v\" , want \" ECC OID\" ." , i .Name )
119
+ }
120
+ if i .Value != note {
121
+ t .Errorf ("OID.Value = \" %v\" , want \" %s\" " , i .Value , note )
122
+ }
123
+ if i .Note != "" {
124
+ t .Errorf ("OID.Note = \" %v\" , want \" \" ." , i .Note )
125
+ }
126
+ if i .Dump != dump {
127
+ t .Errorf ("OIS.Dump = \" %v\" , want \" %s\" ." , i .Dump , dump )
128
+ }
129
+ }
130
+
131
+ func TestEccBrainpoolP384r1 (t * testing.T ) {
132
+ data := []byte {0x09 , 0x2B , 0x24 , 0x03 , 0x03 , 0x02 , 0x08 , 0x01 , 0x01 , 0x0B }
133
+ dump := "2b 24 03 03 02 08 01 01 0b"
134
+ note := "brainpoolP384r1"
135
+ reader := reader .New (data )
136
+ oid , err := NewOID (reader )
137
+ if err != nil {
138
+ t .Errorf ("OID = \" %v\" , want nil." , err .Error ())
139
+ }
140
+ i := oid .ToItem (true )
141
+ if i .Name != "ECC OID" {
142
+ t .Errorf ("OID.Name = \" %v\" , want \" ECC OID\" ." , i .Name )
143
+ }
144
+ if i .Value != note {
145
+ t .Errorf ("OID.Value = \" %v\" , want \" %s\" " , i .Value , note )
146
+ }
147
+ if i .Note != "" {
148
+ t .Errorf ("OID.Note = \" %v\" , want \" \" ." , i .Note )
149
+ }
150
+ if i .Dump != dump {
151
+ t .Errorf ("OIS.Dump = \" %v\" , want \" %s\" ." , i .Dump , dump )
152
+ }
153
+ }
154
+
155
+ func TestEccBrainpoolP512r1 (t * testing.T ) {
156
+ data := []byte {0x09 , 0x2B , 0x24 , 0x03 , 0x03 , 0x02 , 0x08 , 0x01 , 0x01 , 0x0D }
157
+ dump := "2b 24 03 03 02 08 01 01 0d"
158
+ note := "brainpoolP512r1"
159
+ reader := reader .New (data )
160
+ oid , err := NewOID (reader )
161
+ if err != nil {
162
+ t .Errorf ("OID = \" %v\" , want nil." , err .Error ())
163
+ }
164
+ i := oid .ToItem (true )
165
+ if i .Name != "ECC OID" {
166
+ t .Errorf ("OID.Name = \" %v\" , want \" ECC OID\" ." , i .Name )
167
+ }
168
+ if i .Value != note {
169
+ t .Errorf ("OID.Value = \" %v\" , want \" %s\" " , i .Value , note )
170
+ }
171
+ if i .Note != "" {
172
+ t .Errorf ("OID.Note = \" %v\" , want \" \" ." , i .Note )
173
+ }
174
+ if i .Dump != dump {
175
+ t .Errorf ("OIS.Dump = \" %v\" , want \" %s\" ." , i .Dump , dump )
176
+ }
177
+ }
178
+
179
+ func TestEccEd25519 (t * testing.T ) {
180
+ data := []byte {0x09 , 0x2B , 0x06 , 0x01 , 0x04 , 0x01 , 0xDA , 0x47 , 0x0F , 0x01 }
181
+ dump := "2b 06 01 04 01 da 47 0f 01"
182
+ note := "ed25519"
183
+ reader := reader .New (data )
184
+ oid , err := NewOID (reader )
185
+ if err != nil {
186
+ t .Errorf ("OID = \" %v\" , want nil." , err .Error ())
187
+ }
188
+ i := oid .ToItem (true )
189
+ if i .Name != "ECC OID" {
190
+ t .Errorf ("OID.Name = \" %v\" , want \" ECC OID\" ." , i .Name )
191
+ }
192
+ if i .Value != note {
193
+ t .Errorf ("OID.Value = \" %v\" , want \" %s\" " , i .Value , note )
194
+ }
195
+ if i .Note != "" {
196
+ t .Errorf ("OID.Note = \" %v\" , want \" \" ." , i .Note )
197
+ }
198
+ if i .Dump != dump {
199
+ t .Errorf ("OIS.Dump = \" %v\" , want \" %s\" ." , i .Dump , dump )
200
+ }
201
+ }
202
+
203
+ func TestEccCurve25519 (t * testing.T ) {
204
+ data := []byte {0x0a , 0x2B , 0x06 , 0x01 , 0x04 , 0x01 , 0x97 , 0x55 , 0x01 , 0x05 , 0x01 }
205
+ dump := "2b 06 01 04 01 97 55 01 05 01"
206
+ note := "cv25519"
63
207
reader := reader .New (data )
64
208
oid , err := NewOID (reader )
65
209
if err != nil {
0 commit comments