This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
tls_test.go
75 lines (69 loc) · 3.33 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
package grpcsql_test
import (
"crypto/tls"
"fmt"
)
func init() {
cert, err := tls.X509KeyPair(certPEMBlock, keyPEMBlock)
if err != nil {
panic(fmt.Sprintf("invalid test X509 key pair: %v", err))
}
tlsConfig.Certificates = []tls.Certificate{cert}
}
var tlsConfig = &tls.Config{
InsecureSkipVerify: true,
}
var certPEMBlock = []byte(`
-----BEGIN CERTIFICATE-----
MIIDpTCCAo2gAwIBAgIJAPDHg2Jq7+LZMA0GCSqGSIb3DQEBCwUAMGkxCzAJBgNV
BAYTAklUMQ4wDAYDVQQIDAVJdGFseTEQMA4GA1UEBwwHQm9sb2duYTEWMBQGA1UE
CgwNQ2Fub25pY2FsIEx0ZDEMMAoGA1UECwwDTFhEMRIwEAYDVQQDDAlsb2NhbGhv
c3QwHhcNMTcwOTE4MDUzNDI5WhcNMTgwOTE4MDUzNDI5WjBpMQswCQYDVQQGEwJJ
VDEOMAwGA1UECAwFSXRhbHkxEDAOBgNVBAcMB0JvbG9nbmExFjAUBgNVBAoMDUNh
bm9uaWNhbCBMdGQxDDAKBgNVBAsMA0xYRDESMBAGA1UEAwwJbG9jYWxob3N0MIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwcUWD3qG8GqkhjhNrcKrygGi
zE4CW+NBRpAIKgb/YDj6S9hM1VcXgXQYN3XgL7H+7STyYNO4wzvCDGOO4Lmzm4s9
8YrjEOM/5DuhZuzB+V94w4Sp/JKWGPL8TBt6uatClpxZl0U/7rGyfxeyWXXwmbvS
Cw4z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