@@ -157,14 +157,15 @@ Go back to the **[Table of Contents](https://github.com/trimstray/nginx-admins-h
157
157
* [ Generate CSR with -config param] ( #generate-csr-with--config-param )
158
158
* [ Generate private key and CSR] ( #generate-private-key-and-csr )
159
159
* [ List available EC curves] ( #list-available-ec-curves )
160
+ * [ Print ECDSA private and public keys] ( #print-ecdsa-private-and-public-keys )
160
161
* [ Generate ECDSA private key] ( #generate-ecdsa-private-key )
161
162
* [ Generate private key and CSR (ECC)] ( #generate-private-key-with-csr-ecc )
162
163
* [ Generate self-signed certificate] ( #generate-self-signed-certificate )
163
164
* [ Generate self-signed certificate from existing private key] ( #generate-self-signed-certificate-from-existing-private-key )
164
165
* [ Generate self-signed certificate from existing private key and csr] ( #generate-self-signed-certificate-from-existing-private-key-and-csr )
165
- * [ Generate multidomain certificate] ( #generate-multidomain-certificate )
166
- * [ Generate wildcard certificate] ( #generate-wildcard-certificate )
167
- * [ Generate certificate with 4096 bit private key] ( #generate-certificate-with-4096-bit-private-key )
166
+ * [ Generate multidomain certificate (Certbot) ] ( #generate-multidomain-certificate-certbot )
167
+ * [ Generate wildcard certificate (Certbot) ] ( #generate-wildcard-certificate-certbot )
168
+ * [ Generate certificate with 4096 bit private key (Certbot) ] ( #generate-certificate-with-4096-bit-private-key-certbot )
168
169
* [ Generate DH public parameters] ( #generate-dh-public-parameters )
169
170
* [ Display DH public parameters] ( #display-dh-public-parameters )
170
171
* [ Extract private key from pfx] ( #extract-private-key-from-pfx )
@@ -179,8 +180,8 @@ Go back to the **[Table of Contents](https://github.com/trimstray/nginx-admins-h
179
180
* [ Verification of the public key] ( #verification-of-the-public-key )
180
181
* [ Verification of the certificate] ( #verification-of-the-certificate )
181
182
* [ Verification of the CSR] ( #verification-of-the-csr )
182
- * [ Check whether the private key and the certificate match] ( #check-whether- the-private-key-and-the-certificate-match )
183
- * [ Check whether the private key and the CSR match] ( #check-whether- the-private-key-and-the-csr-match )
183
+ * [ Check the private key and the certificate are match] ( #check-the-private-key-and-the-certificate-are -match )
184
+ * [ Check the private key and the CSR are match] ( #check-the-private-key-and-the-csr-are -match )
184
185
* [ TLSv1.3 and CCM ciphers] ( #tlsv13-and-ccm-ciphers )
185
186
186
187
#### Installing from prebuilt packages
@@ -7492,7 +7493,7 @@ htpasswd -c htpasswd_example.com.conf <username>
7492
7493
7493
7494
```bash
7494
7495
# _len: 2048 , 4096
7495
- ( _fd="private.key" ; _len="4096 " ; \
7496
+ ( _fd="private.key" ; _len="2048 " ; \
7496
7497
openssl genrsa -out ${_fd} ${_len} )
7497
7498
```
7498
7499
@@ -7501,7 +7502,7 @@ openssl genrsa -out ${_fd} ${_len} )
7501
7502
```bash
7502
7503
# _ciph: des3 , aes128 , aes256
7503
7504
# _len: 2048 , 4096
7504
- ( _ciph="aes128 " ; _fd="private.key" ; _len="4096 " ; \
7505
+ ( _ciph="aes128 " ; _fd="private.key" ; _len="2048 " ; \
7505
7506
openssl genrsa -${_ciph} - out ${_fd} ${_len} )
7506
7507
```
7507
7508
@@ -7520,6 +7521,13 @@ openssl rsa -in ${_fd} -out ${_fd_unp} )
7520
7521
openssl rsa -${_ciph} - in ${_fd} - out ${_fd_pass}
7521
7522
```
7522
7523
7524
+ ###### Generate private key and CSR
7525
+
7526
+ ```bash
7527
+ ( _fd="private.key" ; _fd_csr="request.csr" ; _len="2048 " ; \
7528
+ openssl req -out ${_fd_csr} - new - newkey rsa: ${_len} - nodes - keyout ${_fd} )
7529
+ ```
7530
+
7523
7531
###### Generate CSR
7524
7532
7525
7533
```bash
@@ -7604,17 +7612,21 @@ For more information please look at these great explanations:
7604
7612
- [Your OpenSSL CSR command is out of date](https://expeditedsecurity.com/blog/openssl-csr-command/)
7605
7613
- [OpenSSL example configuration file](https://www.tbs-certificats.com/openssl-dem-server-cert.cnf)
7606
7614
7607
- ###### Generate private key and CSR
7615
+ ###### List available EC curves
7608
7616
7609
7617
```bash
7610
- ( _fd="private.key" ; _fd_csr="request.csr" ; _len="4096" ; \
7611
- openssl req -out ${_fd_csr} -new -newkey rsa:${_len} -nodes -keyout ${_fd} )
7618
+ openssl ecparam -list_curves
7612
7619
```
7613
7620
7614
- ###### List available EC curves
7621
+ ###### Print ECDSA private and public keys
7615
7622
7616
7623
```bash
7617
- openssl ecparam -list_curves
7624
+ ( _fd="private.key" ; \
7625
+ openssl ec -in ${_fd} -noout -text )
7626
+
7627
+ # For x25519 only extracting public key
7628
+ ( _fd="private.key" ; _fd_pub="public.key" ; \
7629
+ openssl pkey -in ${_fd} -pubout -out ${_fd_pub} )
7618
7630
```
7619
7631
7620
7632
###### Generate ECDSA private key
@@ -7642,7 +7654,7 @@ openssl req -new -key ${_fd} -out ${_fd_csr} -sha256 )
7642
7654
7643
7655
```bash
7644
7656
# _len: 2048, 4096
7645
- ( _fd="domain.key" ; _fd_out="domain.crt" ; _len="4096 " ; _days="365" ; \
7657
+ ( _fd="domain.key" ; _fd_out="domain.crt" ; _len="2048 " ; _days="365" ; \
7646
7658
openssl req -newkey rsa:${_len} -nodes \
7647
7659
-keyout ${_fd} -x509 -days ${_days} -out ${_fd_out} )
7648
7660
```
@@ -7665,19 +7677,19 @@ openssl x509 -signkey ${_fd} -nodes \
7665
7677
-in ${_fd_csr} -req -days ${_days} -out ${_fd_out} )
7666
7678
```
7667
7679
7668
- ###### Generate multidomain certificate
7680
+ ###### Generate multidomain certificate (Certbot)
7669
7681
7670
7682
```bash
7671
7683
certbot certonly -d example.com -d www.example.com
7672
7684
```
7673
7685
7674
- ###### Generate wildcard certificate
7686
+ ###### Generate wildcard certificate (Certbot)
7675
7687
7676
7688
```bash
7677
7689
certbot certonly --manual --preferred-challenges=dns -d example.com -d *.example.com
7678
7690
```
7679
7691
7680
- ###### Generate certificate with 4096 bit private key
7692
+ ###### Generate certificate with 4096 bit private key (Certbot)
7681
7693
7682
7694
```bash
7683
7695
certbot certonly -d example.com -d www.example.com --rsa-key-size 4096
@@ -7789,14 +7801,14 @@ openssl x509 -noout -text -in ${_fd} )
7789
7801
openssl req -text -noout -in ${_fd_csr} )
7790
7802
` ` `
7791
7803
7792
- # ##### Check whether the private key and the certificate match
7804
+ # ##### Check the private key and the certificate are match
7793
7805
7794
7806
` ` ` bash
7795
7807
(openssl rsa -noout -modulus -in private.key | openssl md5 ; \
7796
7808
openssl x509 -noout -modulus -in certificate.crt | openssl md5) | uniq
7797
7809
` ` `
7798
7810
7799
- # ##### Check whether the private key and the CSR match
7811
+ # ##### Check the private key and the CSR are match
7800
7812
7801
7813
` ` ` bash
7802
7814
(openssl rsa -noout -modulus -in private.key | openssl md5 ; \
0 commit comments