1 |
747 |
jeremybenn |
// Copyright 2009 The Go Authors. All rights reserved.
|
2 |
|
|
// Use of this source code is governed by a BSD-style
|
3 |
|
|
// license that can be found in the LICENSE file.
|
4 |
|
|
|
5 |
|
|
package pem
|
6 |
|
|
|
7 |
|
|
import (
|
8 |
|
|
"bytes"
|
9 |
|
|
"reflect"
|
10 |
|
|
"testing"
|
11 |
|
|
)
|
12 |
|
|
|
13 |
|
|
type GetLineTest struct {
|
14 |
|
|
in, out1, out2 string
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
var getLineTests = []GetLineTest{
|
18 |
|
|
{"abc", "abc", ""},
|
19 |
|
|
{"abc\r", "abc\r", ""},
|
20 |
|
|
{"abc\n", "abc", ""},
|
21 |
|
|
{"abc\r\n", "abc", ""},
|
22 |
|
|
{"abc\nd", "abc", "d"},
|
23 |
|
|
{"abc\r\nd", "abc", "d"},
|
24 |
|
|
{"\nabc", "", "abc"},
|
25 |
|
|
{"\r\nabc", "", "abc"},
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
func TestGetLine(t *testing.T) {
|
29 |
|
|
for i, test := range getLineTests {
|
30 |
|
|
x, y := getLine([]byte(test.in))
|
31 |
|
|
if string(x) != test.out1 || string(y) != test.out2 {
|
32 |
|
|
t.Errorf("#%d got:%+v,%+v want:%s,%s", i, x, y, test.out1, test.out2)
|
33 |
|
|
}
|
34 |
|
|
}
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
func TestDecode(t *testing.T) {
|
38 |
|
|
result, remainder := Decode([]byte(pemData))
|
39 |
|
|
if !reflect.DeepEqual(result, certificate) {
|
40 |
|
|
t.Errorf("#0 got:%#v want:%#v", result, certificate)
|
41 |
|
|
}
|
42 |
|
|
result, remainder = Decode(remainder)
|
43 |
|
|
if !reflect.DeepEqual(result, privateKey) {
|
44 |
|
|
t.Errorf("#1 got:%#v want:%#v", result, privateKey)
|
45 |
|
|
}
|
46 |
|
|
result, _ = Decode([]byte(pemPrivateKey))
|
47 |
|
|
if !reflect.DeepEqual(result, privateKey2) {
|
48 |
|
|
t.Errorf("#2 got:%#v want:%#v", result, privateKey2)
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
func TestEncode(t *testing.T) {
|
53 |
|
|
r := EncodeToMemory(privateKey2)
|
54 |
|
|
if string(r) != pemPrivateKey {
|
55 |
|
|
t.Errorf("got:%s want:%s", r, pemPrivateKey)
|
56 |
|
|
}
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
type lineBreakerTest struct {
|
60 |
|
|
in, out string
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
const sixtyFourCharString = "0123456789012345678901234567890123456789012345678901234567890123"
|
64 |
|
|
|
65 |
|
|
var lineBreakerTests = []lineBreakerTest{
|
66 |
|
|
{"", ""},
|
67 |
|
|
{"a", "a\n"},
|
68 |
|
|
{"ab", "ab\n"},
|
69 |
|
|
{sixtyFourCharString, sixtyFourCharString + "\n"},
|
70 |
|
|
{sixtyFourCharString + "X", sixtyFourCharString + "\nX\n"},
|
71 |
|
|
{sixtyFourCharString + sixtyFourCharString, sixtyFourCharString + "\n" + sixtyFourCharString + "\n"},
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
func TestLineBreaker(t *testing.T) {
|
75 |
|
|
for i, test := range lineBreakerTests {
|
76 |
|
|
buf := new(bytes.Buffer)
|
77 |
|
|
var breaker lineBreaker
|
78 |
|
|
breaker.out = buf
|
79 |
|
|
_, err := breaker.Write([]byte(test.in))
|
80 |
|
|
if err != nil {
|
81 |
|
|
t.Errorf("#%d: error from Write: %s", i, err)
|
82 |
|
|
continue
|
83 |
|
|
}
|
84 |
|
|
err = breaker.Close()
|
85 |
|
|
if err != nil {
|
86 |
|
|
t.Errorf("#%d: error from Close: %s", i, err)
|
87 |
|
|
continue
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
if string(buf.Bytes()) != test.out {
|
91 |
|
|
t.Errorf("#%d: got:%s want:%s", i, string(buf.Bytes()), test.out)
|
92 |
|
|
}
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
for i, test := range lineBreakerTests {
|
96 |
|
|
buf := new(bytes.Buffer)
|
97 |
|
|
var breaker lineBreaker
|
98 |
|
|
breaker.out = buf
|
99 |
|
|
|
100 |
|
|
for i := 0; i < len(test.in); i++ {
|
101 |
|
|
_, err := breaker.Write([]byte(test.in[i : i+1]))
|
102 |
|
|
if err != nil {
|
103 |
|
|
t.Errorf("#%d: error from Write (byte by byte): %s", i, err)
|
104 |
|
|
continue
|
105 |
|
|
}
|
106 |
|
|
}
|
107 |
|
|
err := breaker.Close()
|
108 |
|
|
if err != nil {
|
109 |
|
|
t.Errorf("#%d: error from Close (byte by byte): %s", i, err)
|
110 |
|
|
continue
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
if string(buf.Bytes()) != test.out {
|
114 |
|
|
t.Errorf("#%d: (byte by byte) got:%s want:%s", i, string(buf.Bytes()), test.out)
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
var pemData = `verify return:0
|
120 |
|
|
-----BEGIN CERTIFICATE-----
|
121 |
|
|
sdlfkjskldfj
|
122 |
|
|
-----BEGIN CERTIFICATE-----
|
123 |
|
|
---
|
124 |
|
|
Certificate chain
|
125 |
|
|
|
126 |
|
|
i:/C=ZA/O=CA Inc./CN=CA Inc
|
127 |
|
|
-----BEGIN CERTIFICATE-----
|
128 |
|
|
testing
|
129 |
|
|
-----BEGIN CERTIFICATE-----
|
130 |
|
|
-----BEGIN CERTIFICATE-----
|
131 |
|
|
MIID6TCCA1ICAQEwDQYJKoZIhvcNAQEFBQAwgYsxCzAJBgNVBAYTAlVTMRMwEQYD
|
132 |
|
|
VQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRQwEgYDVQQK
|
133 |
|
|
EwtHb29nbGUgSW5jLjEMMAoGA1UECxMDRW5nMQwwCgYDVQQDEw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
|
|
Pomjn71GNTtDeWAXibjCgdL6iHACCF6Htbl0zGlG0OAK+bdn0QIDAQABMA0GCSqG
|
149 |
|
|
SIb3DQEBBQUAA4GBAOKnQDtqBV24vVqvesL5dnmyFpFPXBn3WdFfwD6DzEb21UVG
|
150 |
|
|
5krmJiu+ViipORJPGMkgoL6BjU21XI95VQbun5P8vvg8Z+FnFsvRFY3e1CCzAVQY
|
151 |
|
|
ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g
|
152 |
|
|
-----END CERTIFICATE-----
|
153 |
|
|
1 s:/C=ZA/O=Ca Inc./CN=CA Inc
|
154 |
|
|
|
155 |
|
|
-----BEGIN RSA PRIVATE KEY-----
|
156 |
|
|
Proc-Type: 4,ENCRYPTED
|
157 |
|
|
DEK-Info: DES-EDE3-CBC,80C7C7A09690757A
|
158 |
|
|
|
159 |
|
|
eQp5ZkH6CyHBz7BZfUPxyLCCmftsBJ7HlqGb8Ld21cSwnzWZ4/SIlhyrUtsfw7VR
|
160 |
|
|
2TTwA+odo9ex7GdxOTaH8oZFumIRoiEjHsk8U7Bhntp+ekkPP79xunnN7hb7hkhr
|
161 |
|
|
yGDQZgA7s2cQHQ71v3gwT2BACAft26jCjbM1wgNzBnJ8M0Rzn68YWqaPtdBu8qb/
|
162 |
|
|
zVR5JB1mnqvTSbFsfF5yMc6o2WQ9jJCl6KypnMl+BpL+dlvdjYVK4l9lYsB1Hs3d
|
163 |
|
|
+zDBbWxos818zzhS8/y6eIfiSG27cqrbhURbmgiSfDXjncK4m/pLcQ7mmBL6mFOr
|
164 |
|
|
3Pj4jepzgOiFRL6MKE//h62fZvI1ErYr8VunHEykgKNhChDvb1RO6LEfqKBu+Ivw
|
165 |
|
|
TB6fBhW3TCLMnVPYVoYwA+fHNTmZZm8BEonlIMfI+KktjWUg4Oia+NI6vKcPpFox
|
166 |
|
|
hSnlGgCtvfEaq5/H4kHJp95eOpnFsLviw2seHNkz/LxJMRP1X428+DpYW/QD/0JU
|
167 |
|
|
tJSuC/q9FUHL6RI3u/Asrv8pCb4+D7i1jW/AMIdJTtycOGsbPxQA7yHMWujHmeb1
|
168 |
|
|
BTiHcL3s3KrJu1vDVrshvxfnz71KTeNnZH8UbOqT5i7fPGyXtY1XJddcbI/Q6tXf
|
169 |
|
|
wHFsZc20TzSdsVLBtwksUacpbDogcEVMctnNrB8FIrB3vZEv9Q0Z1VeY7nmTpF+6
|
170 |
|
|
a+z2P7acL7j6A6Pr3+q8P9CPiPC7zFonVzuVPyB8GchGR2hytyiOVpuD9+k8hcuw
|
171 |
|
|
ZWAaUoVtWIQ52aKS0p19G99hhb+IVANC4akkdHV4SP8i7MVNZhfUmg==
|
172 |
|
|
-----END RSA PRIVATE KEY-----`
|
173 |
|
|
|
174 |
|
|
var certificate = &Block{Type: "CERTIFICATE",
|
175 |
|
|
Headers: map[string]string{},
|
176 |
|
|
Bytes: []uint8{0x30, 0x82, 0x3, 0xe9, 0x30, 0x82, 0x3, 0x52, 0x2, 0x1,
|
177 |
|
|
0x1, 0x30, 0xd, 0x6, 0x9, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0xd,
|
178 |
|
|
0x1, 0x1, 0x5, 0x5, 0x0, 0x30, 0x81, 0x8b, 0x31, 0xb, 0x30,
|
179 |
|
|
0x9, 0x6, 0x3, 0x55, 0x4, 0x6, 0x13, 0x2, 0x55, 0x53, 0x31,
|
180 |
|
|
0x13, 0x30, 0x11, 0x6, 0x3, 0x55, 0x4, 0x8, 0x13, 0xa, 0x43,
|
181 |
|
|
0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, 0x31,
|
182 |
|
|
0x16, 0x30, 0x14, 0x6, 0x3, 0x55, 0x4, 0x7, 0x13, 0xd, 0x53,
|
183 |
|
|
0x61, 0x6e, 0x20, 0x46, 0x72, 0x61, 0x6e, 0x63, 0x69, 0x73,
|
184 |
|
|
0x63, 0x6f, 0x31, 0x14, 0x30, 0x12, 0x6, 0x3, 0x55, 0x4, 0xa,
|
185 |
|
|
0x13, 0xb, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49,
|
186 |
|
|
0x6e, 0x63, 0x2e, 0x31, 0xc, 0x30, 0xa, 0x6, 0x3, 0x55, 0x4,
|
187 |
|
|
0xb, 0x13, 0x3, 0x45, 0x6e, 0x67, 0x31, 0xc, 0x30, 0xa, 0x6,
|
188 |
|
|
0x3, 0x55, 0x4, 0x3, 0x13, 0x3, 0x61, 0x67, 0x6c, 0x31, 0x1d,
|
189 |
|
|
0x30, 0x1b, 0x6, 0x9, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0xd, 0x1,
|
190 |
|
|
0x9, 0x1, 0x16, 0xe, 0x61, 0x67, 0x6c, 0x40, 0x67, 0x6f, 0x6f,
|
191 |
|
|
0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17,
|
192 |
|
|
0xd, 0x30, 0x39, 0x30, 0x39, 0x30, 0x39, 0x32, 0x32, 0x30,
|
193 |
|
|
0x35, 0x34, 0x33, 0x5a, 0x17, 0xd, 0x31, 0x30, 0x30, 0x39,
|
194 |
|
|
0x30, 0x39, 0x32, 0x32, 0x30, 0x35, 0x34, 0x33, 0x5a, 0x30,
|
195 |
|
|
0x6a, 0x31, 0xb, 0x30, 0x9, 0x6, 0x3, 0x55, 0x4, 0x6, 0x13,
|
196 |
|
|
0x2, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x6, 0x3, 0x55, 0x4,
|
197 |
|
|
0x8, 0x13, 0xa, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61,
|
198 |
|
|
0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x6, 0x3, 0x55, 0x4, 0xa,
|
199 |
|
|
0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74,
|
200 |
|
|
0x20, 0x57,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
|
|
0xf9, 0x76, 0x79, 0xb2, 0x16, 0x91, 0x4f, 0x5c, 0x19, 0xf7,
|
263 |
|
|
0x59, 0xd1, 0x5f, 0xc0, 0x3e, 0x83, 0xcc, 0x46, 0xf6, 0xd5,
|
264 |
|
|
0x45, 0x46, 0xe6, 0x4a, 0xe6, 0x26, 0x2b, 0xbe, 0x56, 0x28,
|
265 |
|
|
0xa9, 0x39, 0x12, 0x4f, 0x18, 0xc9, 0x20, 0xa0, 0xbe, 0x81,
|
266 |
|
|
0x8d, 0x4d, 0xb5, 0x5c, 0x8f, 0x79, 0x55, 0x6, 0xee, 0x9f,
|
267 |
|
|
0x93, 0xfc, 0xbe, 0xf8, 0x3c, 0x67, 0xe1, 0x67, 0x16, 0xcb,
|
268 |
|
|
0xd1, 0x15, 0x8d, 0xde, 0xd4, 0x20, 0xb3, 0x1, 0x54, 0x18,
|
269 |
|
|
0x66, 0xc5, 0x24, 0x2f, 0xd, 0x88, 0xef, 0x32, 0x3f, 0x74,
|
270 |
|
|
0xd9, 0x56, 0x74, 0x1f, 0x17, 0xa7, 0xbb, 0xfe, 0xdf, 0xf,
|
271 |
|
|
0x6c, 0x5f, 0x93, 0x77, 0x27, 0xf5, 0xae, 0x27, 0x52, 0x8e,
|
272 |
|
|
0x3b, 0x99, 0xb6, 0xea, 0x44, 0x65, 0x1d, 0xa, 0x3b, 0x13,
|
273 |
|
|
0x34, 0xf7, 0xf7, 0xbe, 0x20,
|
274 |
|
|
},
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
var privateKey = &Block{Type: "RSA PRIVATE KEY",
|
278 |
|
|
Headers: map[string]string{"DEK-Info": "DES-EDE3-CBC,80C7C7A09690757A", "Proc-Type": "4,ENCRYPTED"},
|
279 |
|
|
Bytes: []uint8{0x79, 0xa, 0x79, 0x66, 0x41, 0xfa, 0xb,
|
280 |
|
|
0x21, 0xc1, 0xcf, 0xb0, 0x59, 0x7d, 0x43, 0xf1, 0xc8, 0xb0,
|
281 |
|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 0xb4, 0x4f,
|
328 |
|
|
0x34, 0x9d, 0xb1, 0x52, 0xc1, 0xb7, 0x9, 0x2c, 0x51, 0xa7,
|
329 |
|
|
0x29, 0x6c, 0x3a, 0x20, 0x70, 0x45, 0x4c, 0x72, 0xd9, 0xcd,
|
330 |
|
|
0xac, 0x1f, 0x5, 0x22, 0xb0, 0x77, 0xbd, 0x91, 0x2f, 0xf5,
|
331 |
|
|
0xd, 0x19, 0xd5, 0x57, 0x98, 0xee, 0x79, 0x93, 0xa4, 0x5f,
|
332 |
|
|
0xba, 0x6b, 0xec, 0xf6, 0x3f, 0xb6, 0x9c, 0x2f, 0xb8, 0xfa,
|
333 |
|
|
0x3, 0xa3, 0xeb, 0xdf, 0xea, 0xbc, 0x3f, 0xd0, 0x8f, 0x88,
|
334 |
|
|
0xf0, 0xbb, 0xcc, 0x5a, 0x27, 0x57, 0x3b, 0x95, 0x3f, 0x20,
|
335 |
|
|
0x7c, 0x19, 0xc8, 0x46, 0x47, 0x68, 0x72, 0xb7, 0x28, 0x8e,
|
336 |
|
|
0x56, 0x9b, 0x83, 0xf7, 0xe9, 0x3c, 0x85, 0xcb, 0xb0, 0x65,
|
337 |
|
|
0x60, 0x1a, 0x52, 0x85, 0x6d, 0x58, 0x84, 0x39, 0xd9, 0xa2,
|
338 |
|
|
0x92, 0xd2, 0x9d, 0x7d, 0x1b, 0xdf, 0x61, 0x85, 0xbf, 0x88,
|
339 |
|
|
0x54, 0x3, 0x42, 0xe1, 0xa9, 0x24, 0x74, 0x75, 0x78, 0x48,
|
340 |
|
|
0xff, 0x22, 0xec, 0xc5, 0x4d, 0x66, 0x17, 0xd4, 0x9a,
|
341 |
|
|
},
|
342 |
|
|
}
|
343 |
|
|
|
344 |
|
|
var privateKey2 = &Block{Type: "RSA PRIVATE KEY",
|
345 |
|
|
Headers: map[string]string{},
|
346 |
|
|
Bytes: []uint8{0x30, 0x82, 0x1, 0x3a, 0x2, 0x1, 0x0, 0x2,
|
347 |
|
|
0x41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e6, 0xe, 0x2d, 0xfa,
|
363 |
|
|
0x42, 0xd5, 0xa, 0x9b, 0x4, 0x21, 0x90, 0x32, 0x71, 0x5e,
|
364 |
|
|
0x46, 0xb3, 0x2, 0x21, 0x0, 0xd1, 0xf, 0x2e, 0x66, 0xb1,
|
365 |
|
|
0xd0, 0xc1, 0x3f, 0x10, 0xef, 0x99, 0x27, 0xbf, 0x53, 0x24,
|
366 |
|
|
0xa3, 0x79, 0xca, 0x21, 0x81, 0x46, 0xcb, 0xf9, 0xca, 0xfc,
|
367 |
|
|
0x79, 0x52, 0x21, 0xf1, 0x6a, 0x31, 0x17, 0x2, 0x20, 0x21,
|
368 |
|
|
0x2, 0x89, 0x79, 0x37, 0x81, 0x14, 0xca, 0xae, 0x88, 0xf7,
|
369 |
|
|
0xd, 0x6b, 0x61, 0xd8, 0x4f, 0x30, 0x6a, 0x4b, 0x7e, 0x4e,
|
370 |
|
|
0xc0, 0x21, 0x4d, 0xac, 0x9d, 0xf4, 0x49, 0xe8, 0xda, 0xb6,
|
371 |
|
|
0x9, 0x2, 0x20, 0x16, 0xb3, 0xec, 0x59, 0x10, 0xa4, 0x57,
|
372 |
|
|
0xe8, 0xe, 0x61, 0xc6, 0xa3, 0xf, 0x5e, 0xeb, 0x12, 0xa9,
|
373 |
|
|
0xae, 0x2e, 0xb7, 0x48, 0x45, 0xec, 0x69, 0x83, 0xc3, 0x75,
|
374 |
|
|
0xc, 0xe4, 0x97, 0xa0, 0x9f, 0x2, 0x20, 0x69, 0x52, 0xb4,
|
375 |
|
|
0x6, 0xe8, 0x50, 0x60, 0x71, 0x4c, 0x3a, 0xb7, 0x66, 0xba,
|
376 |
|
|
0xd, 0x8a, 0xc9, 0xb7, 0xd, 0xa3, 0x8, 0x6c, 0xa3, 0xf2,
|
377 |
|
|
0x62, 0xb0, 0x2a, 0x84, 0xaa, 0x2f, 0xd6, 0x1e, 0x55,
|
378 |
|
|
},
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
var pemPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
|
382 |
|
|
MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0
|
383 |
|
|
fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu
|
384 |
|
|
/ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu
|
385 |
|
|
RTUCIQDasvGASLqmjeffBNLTXV2A5g4t+kLVCpsEIZAycV5GswIhANEPLmax0ME/
|
386 |
|
|
EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A
|
387 |
|
|
IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS
|
388 |
|
|
tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V
|
389 |
|
|
-----END RSA PRIVATE KEY-----
|
390 |
|
|
`
|