Debian Codegraph @

testenv/certs/README

raw
1 To create the server RSA private key:
2 $ certtool --generate-privkey --outfile server-key.pem --rsa
3
4
5 To create a self signed CA certificate:
6 $ certtool --generate-privkey --outfile ca-key.pem
7 $ certtool --generate-self-signed --load-privkey ca-key.pem --outfile ca-cert.pem
8 Common name: GNU Wget
9 UID:
10 Organizational unit name: Wget
11 Organization name: GNU
12 Locality name:
13 State or province name:
14 Country name (2 chars):
15 Enter the subject's domain component (DC):
16 This field should not be used in new certificates.
17 E-mail:
18 Enter the certificate's serial number in decimal (default: 6080487640893163573):
19
20 Activation/Expiration time.
21 The certificate will expire in (days): -1
22
23 Extensions.
24 Does the certificate belong to an authority? (y/N): y
25 Path length constraint (decimal, -1 for no constraint):
26 Is this a TLS web client certificate? (y/N):
27 Will the certificate be used for IPsec IKE operations? (y/N):
28 Is this a TLS web server certificate? (y/N):
29 Enter a dnsName of the subject of the certificate:
30 Enter a URI of the subject of the certificate:
31 Enter the IP address of the subject of the certificate:
32 Enter the e-mail of the subject of the certificate:
33 Will the certificate be used to sign OCSP requests? (y/N):
34 Will the certificate be used to sign code? (y/N):
35 Will the certificate be used for time stamping? (y/N):
36 Will the certificate be used to sign other certificates? (y/N): y
37 Will the certificate be used to sign CRLs? (y/N): y
38 Enter the URI of the CRL distribution point:
39
40
41 To generate a server certificate using the private key only:
42 $ certtool --generate-certificate --load-privkey server-key.pem --outfile server-cert.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
43 Common name: 127.0.0.1
44 UID:
45 Organizational unit name: Wget
46 Organization name: GNU
47 Locality name:
48 State or province name:
49 Country name (2 chars):
50 Enter the subject's domain component (DC):
51 This field should not be used in new certificates.
52 E-mail:
53 Enter the certificate's serial number in decimal (default: 6080488276853553635):
54
55 Activation/Expiration time.
56 The certificate will expire in (days): -1
57
58 Extensions.
59 Does the certificate belong to an authority? (y/N):
60 Is this a TLS web client certificate? (y/N):
61 Will the certificate be used for IPsec IKE operations? (y/N):
62 Is this a TLS web server certificate? (y/N): y
63 Enter a dnsName of the subject of the certificate: 127.0.0.1
64 Enter a dnsName of the subject of the certificate: localhost
65 Enter a dnsName of the subject of the certificate:
66 Enter a URI of the subject of the certificate:
67 Enter the IP address of the subject of the certificate:
68 Will the certificate be used for signing (DHE and RSA-EXPORT ciphersuites)? (Y/n):
69 Will the certificate be used for encryption (RSA ciphersuites)? (Y/n):
70
71
72 To create a CRL for the server certificate:
73 $ certtool --generate-crl --load-ca-privkey ca-key.pem --load-ca-certificate ca-cert.pem --load-certificate server-cert.pem --outfile server-crl.pem
74 Generating a signed CRL...
75 Update times.
76 The certificate will expire in (days): -1
77 CRL Number (default: 6080006793650397145):
78
79 To generate a public key in PEM format:
80 $ openssl x509 -noout -pubkey < server-cert.pem > server-pubkey.pem
81
82 To generate a public key in DER format:
83 $ openssl x509 -noout -pubkey < server-cert.pem | openssl asn1parse -noout -inform pem -out server-pubkey.der
84
85 To generate a sha256 hash of the public key:
86 $ openssl x509 -noout -pubkey < server-cert.pem | openssl asn1parse -noout -inform pem -out /dev/stdout | openssl dgst -sha256 -binary | openssl base64
87 mHiEhWHvusnzP7COZk+SzSJ+Gl7nZT+ADx0PUnDD7mM=