• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..07-Apr-2021-

README.mdH A D07-Apr-20211.7 KiB4834

another_client_cert_1.pemH A D07-Apr-20217 KiB123121

another_client_key_1.pemH A D07-Apr-20213.2 KiB5251

client_cert_1.pemH A D07-Apr-20217 KiB123121

client_cert_2.pemH A D07-Apr-20217 KiB123121

client_key_1.pemH A D07-Apr-20213.2 KiB5251

client_key_2.pemH A D07-Apr-20213.2 KiB5251

client_trust_cert_1.pemH A D07-Apr-20211.9 KiB3332

client_trust_cert_2.pemH A D07-Apr-20212 KiB3433

client_trust_key_1.pemH A D07-Apr-20213.2 KiB5352

client_trust_key_2.pemH A D07-Apr-20213.2 KiB5352

localhost-openssl.cnfH A D07-Apr-2021702 2420

openssl-ca.cnfH A D07-Apr-20212.9 KiB8865

server_cert_1.pemH A D07-Apr-20217 KiB123121

server_cert_2.pemH A D07-Apr-20217 KiB123121

server_cert_3.pemH A D07-Apr-20211.3 KiB2423

server_cert_localhost_1.pemH A D07-Apr-20217 KiB125123

server_key_1.pemH A D07-Apr-20213.2 KiB5251

server_key_2.pemH A D07-Apr-20213.2 KiB5251

server_key_3.pemH A D07-Apr-20211.7 KiB2928

server_key_localhost_1.pemH A D07-Apr-20213.2 KiB5251

server_trust_cert_1.pemH A D07-Apr-20212 KiB3332

server_trust_cert_2.pemH A D07-Apr-20212 KiB3433

server_trust_key_1.pemH A D07-Apr-20213.2 KiB5352

server_trust_key_2.pemH A D07-Apr-20213.2 KiB5352

testdata.goH A D07-Apr-20211.2 KiB4416

README.md

1About This Directory
2-------------
3This testdata directory contains the certificates used in the tests of package advancedtls.
4
5How to Generate Test Certificates Using OpenSSL
6-------------
7
8Supposing we are going to create a `subject_cert.pem` that is trusted by `ca_cert.pem`, here are the
9commands we run:
10
111. Generate the private key, `ca_key.pem`, and the cert `ca_cert.pem`, for the CA:
12
13   ```
14   $ openssl req -x509 -newkey rsa:4096 -keyout ca_key.pem -out ca_cert.pem -nodes -days $DURATION_DAYS
15   ```
16
172. Generate a private key `subject_key.pem` for the subject:
18
19      ```
20      $ openssl genrsa -out subject_key.pem 4096
21      ```
22
233. Generate a CSR `csr.pem` using `subject_key.pem`:
24
25   ```
26   $ openssl req -new -key subject_key.pem -out csr.pem
27   ```
28   For some cases, we might want to add some extra SAN fields in `subject_cert.pem`.
29   In those cases, we can create a configuration file(for example, localhost-openssl.cnf), and do the following:
30   ```
31   $ openssl req -new -key subject_key.pem -out csr.pem -config $CONFIG_FILE_NAME
32   ```
33
344. Use `ca_key.pem` and `ca_cert.pem` to sign `csr.pem`, and get a certificate, `subject_cert.pem`, for the subject:
35
36   This step requires some additional configuration steps and please check out [this answer from StackOverflow](https://stackoverflow.com/a/21340898) for more.
37
38   ```
39   $ openssl ca -config openssl-ca.cnf -policy signing_policy -extensions signing_req -out subject_cert.pem -in csr.pem -keyfile ca_key.pem -cert ca_cert.pem
40   ```
41   Please see an example configuration template at `openssl-ca.cnf`.
425. Verify the `subject_cert.pem` is trusted by `ca_cert.pem`:
43
44
45   ```
46   $ openssl verify -verbose -CAfile ca_cert.pem  subject_cert.pem
47
48   ```