文档更改自建 https 证书
由 Qiongpan Ke 于 2024-06-04 最后修改
由Qiongpan Ke编辑
在2024-06-04上
在2024-06-04上
到版本
由Qiongpan Ke编辑
在2023-07-07上
在2023-07-07上
修改评论:
该版本没有评论
摘要
细节
- 页面属性
-
- 内容
-
... ... @@ -12,7 +12,7 @@ 12 12 13 13 执行结果如下: 14 14 15 -``` txt15 +``` 16 16 $ openssl genrsa -aes256 -out ca_rsa_private.key 4096 17 17 Generating RSA private key, 4096 bit long modulus (2 primes) 18 18 .........++++ ... ... @@ -35,7 +35,7 @@ 35 35 36 36 执行结果如下: 37 37 38 -``` txt38 +``` 39 39 $ openssl rsa -in ca_rsa_private.key -out ca_rsa_private_nopass.key 40 40 Enter pass phrase for ca_rsa_private.key: 41 41 writing RSA key ... ... @@ -53,7 +53,7 @@ 53 53 54 54 执行结果如下: 55 55 56 -``` txt56 +``` 57 57 $ openssl rsa -in ca_rsa_private_nopass.key -pubout -out ca_rsa_public.key 58 58 writing RSA key 59 59 $ ls -ltr ... ... @@ -71,7 +71,7 @@ 71 71 72 72 执行结果如下: 73 73 74 -``` txt74 +``` 75 75 $ openssl req -new -subj "/C=US/ST=California/L=Los Angeles/O=example.com/OU=IANA/CN=Example.com's Root CA/emailAddress=iana@iana.org" -key ca_rsa_private_nopass.key -out ca.csr 76 76 $ ls -ltr 77 77 total 16 ... ... @@ -95,7 +95,7 @@ 95 95 96 96 执行结果如下: 97 97 98 -``` txt98 +``` 99 99 $ openssl req -x509 -days $((365 * 100)) -sha256 -nodes -in ca.csr -key ca_rsa_private_nopass.key -out ca.crt 100 100 $ ls -ltr 101 101 total 20 ... ... @@ -114,7 +114,7 @@ 114 114 115 115 执行结果如下: 116 116 117 -``` txt117 +``` 118 118 $ openssl genrsa -aes256 -out https_rsa_private.key 4096 119 119 Generating RSA private key, 4096 bit long modulus (2 primes) 120 120 ......................................++++ ... ... @@ -142,7 +142,7 @@ 142 142 143 143 执行结果如下: 144 144 145 -``` txt145 +``` 146 146 $ openssl rsa -in https_rsa_private.key -out https_rsa_private_nopass.key 147 147 Enter pass phrase for https_rsa_private.key: 148 148 writing RSA key ... ... @@ -165,7 +165,7 @@ 165 165 166 166 执行结果如下: 167 167 168 -``` txt168 +``` 169 169 $ openssl rsa -in https_rsa_private_nopass.key -pubout -out https_rsa_public.key 170 170 writing RSA key 171 171 $ ls -ltr ... ... @@ -188,7 +188,7 @@ 188 188 189 189 执行结果如下: 190 190 191 -``` txt191 +``` 192 192 $ openssl req -new -subj "/C=US/ST=California/L=Los Angeles/O=example.com/OU=IANA/CN=*.example.com/emailAddress=iana@iana.org" -key https_rsa_private_nopass.key -out https.csr 193 193 $ ls -ltr 194 194 total 36 ... ... @@ -226,7 +226,7 @@ 226 226 227 227 执行结果如下: 228 228 229 -``` txt229 +``` 230 230 $ openssl x509 -req -days $((356 * 2)) -sha256 -extfile <(cat /etc/ssl/openssl.cnf <( 231 231 t <<E> cat <<EOF 232 232 > [v3_san] ... ... @@ -263,7 +263,7 @@ 263 263 264 264 执行结果如下: 265 265 266 -``` txt266 +``` 267 267 $ openssl pkcs12 -export -inkey https_rsa_private_nopass.key -in https.crt -out https.keystore.p12 -name https 268 268 Enter Export Password: 269 269 Verifying - Enter Export Password: ... ... @@ -291,7 +291,7 @@ 291 291 292 292 执行结果如下: 293 293 294 -``` txt294 +``` 295 295 $ keytool -importkeystore -srckeystore https.keystore.p12 -srcstoretype pkcs12 -destkeystore https.keystore.jks -deststoretype jks -v 296 296 Importing keystore https.keystore.p12 to https.keystore.jks... 297 297 Enter destination keystore password: ... ... @@ -331,7 +331,7 @@ 331 331 332 332 执行结果如下: 333 333 334 -``` txt334 +``` 335 335 $ openssl x509 -in ca.crt -noout -text 336 336 Certificate: 337 337 Data: