Debian Codegraph @

src/core/tsi/test_creds/README

raw
1 The test credentials (CONFIRMEDTESTKEY) have been generated with the following
2 commands:
3
4 Bad credentials (badclient.* / badserver.*):
5 ============================================
6
7 These are self-signed certificates:
8
9 $ openssl req -x509 -newkey rsa:2048 -keyout badserver.key -out badserver.pem \
10 -days 3650 -nodes
11
12 When prompted for certificate information, everything is default except the
13 common name which is set to badserver.test.google.com.
14
15
16 Valid test credentials:
17 =======================
18
19 The ca is self-signed:
20 ----------------------
21
22 $ openssl req -x509 -new -newkey rsa:2048 -nodes -keyout ca.key -out ca.pem \
23 -config ca-openssl.cnf -days 3650 -extensions v3_req
24 When prompted for certificate information, everything is default.
25
26 client is issued by CA:
27 -----------------------
28
29 $ openssl genrsa -out client.key.rsa 2048
30 $ openssl pkcs8 -topk8 -in client.key.rsa -out client.key -nocrypt
31 $ openssl req -new -key client.key -out client.csr
32
33 When prompted for certificate information, everything is default except the
34 common name which is set to testclient.
35
36 $ openssl x509 -req -CA ca.pem -CAkey ca.key -CAcreateserial -in client.csr \
37 -out client.pem -days 3650
38
39 client1 is issued by CA:
40 -----------------------
41
42 $ openssl genrsa -out client1.key.rsa 2048
43 $ openssl pkcs8 -topk8 -in client1.key.rsa -out client1.key -nocrypt
44 $ openssl req -new -key client1.key -out client1.csr
45
46 When prompted for certificate information, everything is default except the
47 common name which is set to testclient1.
48
49 $ openssl x509 -req -CA ca.pem -CAkey ca.key -CAcreateserial -in client1.csr \
50 -out client1.pem -days 3650
51
52 client2 is issued by CA:
53 -----------------------
54
55 $ openssl genrsa -out client2.key.rsa 2048
56 $ openssl pkcs8 -topk8 -in client2.key.rsa -out client2.key -nocrypt
57 $ openssl req -new -key client2.key -out client2.csr
58
59 When prompted for certificate information, everything is default except the
60 common name which is set to testclient2.
61
62 $ openssl x509 -req -CA ca.pem -CAkey ca.key -CAcreateserial -in client2.csr \
63 -out client2.pem -days 3650
64
65 server0 is issued by CA:
66 ------------------------
67
68 $ openssl genrsa -out server0.key.rsa 2048
69 $ openssl pkcs8 -topk8 -in server0.key.rsa -out server0.key -nocrypt
70 $ openssl req -new -key server0.key -out server0.csr
71
72 When prompted for certificate information, everything is default except the
73 common name which is set to *.test.google.com.au.
74
75 $ openssl x509 -req -CA ca.pem -CAkey ca.key -CAcreateserial -in server0.csr \
76 -out server0.pem -days 3650
77
78 server1 is issued by CA with a special config for subject alternative names:
79 ----------------------------------------------------------------------------
80
81 $ openssl genrsa -out server1.key.rsa 2048
82 $ openssl pkcs8 -topk8 -in server1.key.rsa -out server1.key -nocrypt
83 $ openssl req -new -key server1.key -out server1.csr -config server1-openssl.cnf
84
85 When prompted for certificate information, everything is default except the
86 common name which is set to *.test.google.com.
87
88 $ openssl x509 -req -CA ca.pem -CAkey ca.key -CAcreateserial -in server1.csr \
89 -out server1.pem -extensions req_ext -extfile server1-openssl.cnf -days 3650
90
91 multi-domain is a self-signed certificate having multiple subject alternative
92 names:
93 ----------------------------------------------------------------------------
94
95 $ openssl genrsa -out multi-domain.key.rsa 2048
96 $ openssl pkcs8 -topk8 -in multi-domain.key.rsa -out multi-domain.key -nocrypt
97 $ openssl req -new -key multi-domain.key -out multi-domain.csr -config
98 multi-domain-openssl.cnf
99 $ openssl req -x509 -new -extensions v3_req -key multi-domain.key -out
100 multi-domain.pem -days 3650 -config multi-domain-openssl.cnf
101
102 Clean up:
103 ---------
104 $ rm *.rsa
105 $ rm *.csr
106 $ rm ca.srl
107
108 Sync up with other repositories
109 ===============================
110
111 Copies of these keys exist in multiple locations across all the grpc repos
112 (e.g., see the following partial list). You need to be careful when updating
113 the keys.
114
115 grpc-dart/interop/
116 grpc-dotnet/testassets/Certs/InteropTests/
117 grpc-go/testdata/
118 grpc-java/testing/src/main/resources/certs/
119 grpc-node/test/data/
120 src/objective-c/tests/TestCertificates.bundle/
121 src/php/tests/data/
122 src/python/grpcio_tests/tests/interop/credentials/
123 src/python/grpcio_tests/tests/unit/credentials/
124 src/ruby/spec/testdata/
125 test/core/end2end/data/
126
127 The following keys/certs are not distributed through multiple grpc repos yet,
128 since they are only used in grpc core tests:
129
130 multi-domain.*
131 client1.*
132 client2.*