-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtls_test.go
134 lines (126 loc) · 6.96 KB
/
tls_test.go
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Copyright 2023 xgfone
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tlsx
const (
// CN: test-ca
CaKey = `-----BEGIN RSA PRIVATE KEY-----
MIIEoAIBAAKCAQEAmgQI4LnyQMNOxGmKAMzZWI1iNc4ng9qgOE8GXVjag3Y+wGL2
alYG7oOZlpxz0qaIwdX345cIe9mPpViw4EsdA2mlVwuYdJxSvthBBHeKxsImyFpf
UDyWmJ67zvPavJAhBeo6GRtAaYMR5QrGQWX2prN1iHahsWhBjRo6A2C/V0U0eQTm
kIJjdNHxoGXozQlKmtxYRbxLYu4zMobK4jTwI4I4ai7hTH518ZrU+lpLbVfE166r
9HoFRR0dnUV1sO46NnuhQvOzBSauDHxJJMyQonzPOTyfEG3WC6FM64R5fVFlaW0w
qvjm3lrB+FeCrycIYMQuJ/0EukAYYoQ/05JpxQIDAQABAoIBADjotL8U9kan5Dr/
JFcXWlg2Jcvr2P4Hkpw71wY3Bsb8skM0TgkMsJMBXYchWErF7lJxVZ9q91+MDF/0
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N39ut8m8hSala1fcNw8uM6fkn
qT7swT4gmfdMiVmPDqv4+QQWZwu5MJHBfkMzpnOt2yyaydlQ8WzJ0RkhmMK4cxg+
OHMMybXTXg95x7C1a+hFflAz+zepgWkaceE0Xks9/VzVV/QFHev7mkOJ/hkiL8oL
515Q/B7bH6eG7pmqW3kt9bKO03HCLW8T/rdlZNqD9oykAebawZmNBHIPAtyKW6rV
6LroKR8ovSvgGFeIRVsGwRf6L2PXVYHCtuAqgDHVWfCPjvBhtVl5C2eveJ/pxsy6
/RRoryY2gb719v6+Dfy5TlYPtksE/w2avciQi67yicQye36t8YYHgg==
-----END CERTIFICATE-----`
CertCN = "test"
// CN: test
// SAN: 127.0.0.1, localhost, www.example.com
// 2021-11-12 ~ 2031-11-10
Cert = `-----BEGIN CERTIFICATE-----
MIIEGzCCAwOgAwIBAgIUD6WXDEVL59WbufV22AOCqWElk7owDQYJKoZIhvcNAQEL
BQAwcTELMAkGA1UEBhMCQ04xETAPBgNVBAgTCFNoYW5nSGFpMREwDwYDVQQHEwhT
aGFuZ0hhaTEUMBIGA1UEChMLZXhhbXBsZS5jb20xFDASBgNVBAsTC2V4YW1wbGUu
Y29tMRAwDgYDVQQDEwd0ZXN0LWNhMB4XDTIxMTExMjAyNTAwMFoXDTMxMTExMDAy
NTAwMFowbjELMAkGA1UEBhMCQ04xETAPBgNVBAgTCFNoYW5nSGFpMREwDwYDVQQH
EwhTaGFuZ0hhaTEUMBIGA1UEChMLZXhhbXBsZS5jb20xFDASBgNVBAsTC2V4YW1w
bGUuY29tMQ0wCwYDVQQDEwR0ZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAsqhOgVEJVZoVg+GPgmgNuDwTuLrci5JQSgMv1ToqYdeD2ij8uZmZjbux
//8uLrBGT8a5dc9YElmS5/2IhVk7Pmb21jhNm0zMjd80Ws5z3Ui4IVU8oQGVGMxq
ASOSd4fzQT8BROq3UsAlxaohpLb05sJDRMrvyqLLrZXowW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hPDW4hafbVpzWtrVJXDaRyfPvth8V17TIPMA+UyfGgseQotIj
++hVOgTZIqyCexbPTGYBwEzfTCX4kKyh3KVI87nqJBfWXJX0+ZPHruWFY9ojUynf
wpchAoGAU8/St9ba0bUPi8GHWTDxuXuNzc8AP0o1RtR2Pf9Z47cCqpQ3ezahE1is
MmP8iEDW74GYOHFRJRYbYyIYt7Mr/Q4tpmYJkWy2PjWEmPirZIcdRpv2HvCJvOQR
SE2fRd4FiCbUdUj1H0haoq1u/NKyK6gObYmealVWC4AQDS9vNFc=
-----END RSA PRIVATE KEY-----`
)
// The DNS names or IP addresses signed by the test certificate.
var (
CertDNSNames = []string{"localhost", "www.example.com"}
CertIPAddresses = []string{"127.0.0.1"}
)