好的。我想我找到了答案
必须创建一个认证机构才能使用HTTPS具有约束力,我们所有的证书都将由此签署。为此,下载合适的版本OpenSSL
从这里:适用于 Windows 的 Win32/Win64 OpenSSL 安装程序 http://slproweb.com/products/Win32OpenSSL.html并安装它。然后,为了快速、轻松地工作,可以制作一些脚本文件,
在文件夹(运行脚本的文件夹)中添加一个名为的文件夹#
。所有证书文件都将存储在那里。
用于创建根证书RootCA.bat
,
openssl genrsa -des3 -out #/RootCA.key 4096
openssl req -x509 -new -nodes -sha256 -days 730 -key #/RootCA.key -out #/RootCA.crt -config rootca.csr
openssl pkcs12 -export -out #/RootCA.p12 -inkey #/RootCA.key -in #/RootCA.crt
openssl pkcs12 -export -out #/RootCA.pem -inkey #/RootCA.key -in #/RootCA.crt
openssl pkcs12 -export -out #/RootCA.pfx -inkey #/RootCA.key -in #/RootCA.crt
并且,对于RootCA
的细节创造RootCa.csr
,
[req]
default_bits = 4096
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
C=US
ST=New York
L=Rochester
O=Developer
OU=CodeSigner
CN=*.codesigning.in
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = *.codesigning.in
当你跑步时RootCA.bat
它将使用创建一个证书RootCa.csr
的详细信息并导出.pem
, .pfx
and .p12
连同证书文件(aRootCA.csr
并且还创建了“RootCA.key”)。
现在,为服务器证书创建server.bat
,
openssl req -new -sha256 -nodes -out #/server.csr -newkey rsa:2048 -keyout #/server.key -config server.csr
openssl x509 -req -in #/server.csr -CA #/RootCA.crt -CAkey #/RootCA.key -CAcreateserial -out #/server.crt -days 365 -sha256 -extfile v3.ext
openssl pkcs12 -export -out #/server.p12 -inkey #/server.key -in #/server.crt -chain -CAfile #/RootCA.crt
openssl pkcs12 -export -out #/server.pem -inkey #/server.key -in #/server.crt -chain -CAfile #/RootCA.crt
openssl pkcs12 -export -out #/server.pfx -inkey #/server.key -in #/server.crt -chain -CAfile #/RootCA.crt
并且,当然,对于详细信息,创建一个server.csr
file,
[req]
default_bits = 4096
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
C=US
ST=New York
L=Rochester
O=Developer
OU=Test & Learn
CN=*.localhost.in
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = *.localhost.in
并且,另一个名为v3.ext
(我不太了解),
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = *.localhost.in
当你跑步时再次server.bat
它将使用创建一个证书server.csr
的详细信息并导出.pem
, .pfx
and .p12
连同证书文件(aserver.csr
and server.key
也被创建)。
注意:您必须修改server.csr
为您的自定义域(默认情况下,它将创建dev.localhost.in
领域)。
!!!警告:您必须记住您输入的密码。你可能会修改RootCA.csr
and RootCA.bat
根据您的需要。 (增加有效期、修改详细信息等)
添加到Windows,
由于我使用 Windows,我只知道导入到 Windows。要在窗口中添加,只需单击RootCA.p12
文件并导入它。请记住,您必须相信RootCA
in 受信任的根证书颁发机构 And in 中级认证机构.
除 Firefox 之外的所有浏览器都会信任该站点。工作完成(部分)!
您可以使用检查它mmc在奔跑中。然后使用管理单元证书Ctrl
+ M
.
添加到FireFox,
Because FireFox uses it own Certificate Managers and doesn't pay any heed to systems certificates. So, You will have to manually have to import the RootCA.crt
for trust And all the inheriting certificates will be trusted. As Follows,
现在,导入证书并简单地添加与证书的 HTTPS 绑定并使用任何服务器(甚至 IIS 等)托管网站。