Debian Codegraph @

internal/v2/testdata/README.md

raw
1 **How example certificates and keys generated in this directory:**
2
3 To create a self signed cert(and private key), Run the following commands using openssl:
4 ```
5 openssl req -x509 -sha256 -days 7305 -newkey rsa:2048 -keyout root_key.pem -out
6 root_cert.pem
7 ```
8 To create a chain of certs:
9
10 ```leafCert.pem``` < ```intermediateCert.pem``` < ```rootCert.pem```
11
12 Run the following commands using openssl:
13
14 Create a self signed root:
15 ```
16 openssl req -x509 -sha256 -days 7305 -newkey rsa:2048 -keyout root_key.pem -out root_cert.pem
17 ```
18 Create a configuration file config.cnf:
19 ```
20 basicConstraints=CA:TRUE
21 ```
22 Create the intermediate cert private key:
23 ```
24 openssl genrsa -out intermediate_key.pem 2048
25 ```
26 Create a certificate signing request:
27 ```
28 openssl req -key intermediate_key.pem -new -out intermediate.csr
29 ```
30 Sign the CSR with the root:
31 ```
32 openssl x509 -req -CA root_cert.pem -CAkey root_key.pem -in intermediate.csr
33 -out intermediate_cert.pem -days 7305 -CAcreateserial -extfile config.cnf
34 ```
35 Create the leaf cert private key:
36 ```
37 openssl genrsa -out leaf_key.pem 2048
38 ```
39 Create a certificate signing request:
40 ```
41 openssl req -key leaf_key.pem -new -out leaf.csr
42 ```
43 Sign the CSR with the intermediate
44 ```
45 openssl x509 -req -CA intermediate_cert.pem -CAkey intermediate_key.pem -in
46 leaf.csr -out leaf_cert.pem -days 7305 -CAcreateserial -extfile config
47 ```
48 TODO(rmehta19): Perhaps put these commands together into a script to make
49 generation of example certs/keys and cert chains simpler.