我正在尝试并且未能创建自签名证书。我想要实现的是在我的手机上使用webworker测试网页,为此我需要https。但是暂时我正试图在我的电脑上本地运行它。
我在Windows上使用openssl(我使用的是来自here的v1.1.0简易版)。
我正在我的计算机上安装CA证书,并且我正在使用提供证书和密钥的浏览器同步https选项为该页面提供服务。
我得到的错误是NET :: ERR_CERT_INVALID。什么可能是无效的部分?
我正在运行的命令:
openssl genrsa -des3 -out CA.key 2048
openssl req -x509 -new -nodes -key CA.key -sha256 -days 182 -out CA.pem -config ca.cfg
openssl x509 -outform der -in CA.pem -out CA.crt
openssl genrsa -out dev.key 2048
openssl req -new -key dev.key -out dev.csr -config dev.cfg
openssl x509 -req -in dev.csr -CA CA.pem -CAkey CA.key -CAcreateserial -out dev.crt -days 1825 -sha256 -extfile dev.ext
openssl pkcs12 -export -in dev.crt -inkey dev.key -out dev.p12
CA.cfg:
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
countryName = Country Name (2 letter code)
countryName_default = PL
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = PL
localityName = Locality Name (eg, city)
localityName_default = PL
organizationName = Organization Name (eg, company)
organizationName_default = Example Organization
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = Example Division
emailAddress = Email Address
emailAddress_default = test@example.com
[ x509_ext ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
keyUsage = digitalSignature, keyEncipherment
subjectAltName = @alternate_names
[ req_ext ]
subjectKeyIdentifier = hash
keyUsage = digitalSignature, keyEncipherment
subjectAltName = @alternate_names
[ alternate_names ]
DNS.1 = 192.168.0.17
dev.cfg
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
countryName = Country Name (2 letter code)
countryName_default = PL
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = PL
localityName = Locality Name (eg, city)
localityName_default = PL
organizationName = Organization Name (eg, company)
organizationName_default = Example Organization
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = Example Division
emailAddress = Email Address
emailAddress_default = test@example.com
[ x509_ext ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
keyUsage = digitalSignature, keyEncipherment
subjectAltName = @alternate_names
[ req_ext ]
subjectKeyIdentifier = hash
keyUsage = digitalSignature, keyEncipherment
subjectAltName = @alternate_names
[ alternate_names ]
DNS.1 = 192.168.0.17
dev.ext:
authorityKeyIdentifier=keyid,issuer
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = 192.168.0.17
答案 0 :(得分:0)
似乎我已经失去了发布这个问题的快速希望。 我找到了this解决方案。
在Windows计算机上同时提供dns(localhost)和ip(例如192.168.0.17)。