2017-09-11 16 views
2

私はSSL証明書を作成するためにthis pageに従っています。
そして、私はopensslを使ってrootCAとサーバ証明書を作成しています。chrome not trust https and show ERR_SSL_SERVER_CERT_BAD_FORMAT

しかし、クロムでこのページが表示されます。 image here
opensslコマンドこれに従ってくださいです:。

"[Apache install path]\bin" openssl genrsa -des3 -out rootCA.key 2048 
"[Apache install path]\bin" openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 3560 -extensions v3_req -out rootCA.pem 

Country Name (2 letter code) [AU]:TW 
State or Province Name (full name) [Some-State]:Taiwan 
Locality Name (eg, city) []:Taipei 
Organization Name (eg, company) [Internet Widgits Pty Ltd]:CR 
Organizational Unit Name (eg, section) []:IT section 
Common Name (eg, server FQDN or YOUR name) []:localhost 
Email Address []:[email protected] 

そして、OSの信頼できる証明書にrootCA.pemをインストールする(私のOSは、Windows 10である)
そして、CSR生成:のみ

set OPENSSL_CONF=[Apache install path]\conf\openssl.cnf (This is apache default) 
openssl genrsa -out server.key 2048 

共通名はrootCAとは異なり、 "html_12"に設定されています。
のhttpd-ssl.confの中

openssl req -new -key server.key -out server.csr 
openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 500 -sha256 -extensions v3_req 

とApacheの設定:

SSLCertificateFile "D:/xampp/Apache2.2_win32/conf/server.crt" 
SSLCertificateKeyFile "D:/xampp/Apache2.2_win32/conf/server.key" 

のhttpd-vhosts.confでは同じである:

<VirtualHost *:80> 
    DocumentRoot "E:/PHP_TEST" 
    ServerName html_12 
    ErrorLog "logs/html_12M-error.log" 
    CustomLog "logs/html_12M-access.log" common 
    SSLEngine on 
    SSLProtocol all -SSLv2 
    SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5 
    SSLCertificateFile "D:/xampp/Apache2.2_win32/conf/server.crt" 
    SSLCertificateKeyFile "D:/xampp/Apache2.2_win32/conf/server.key" 
    SSLCACertificateFile "D:/xampp/Apache2.2_win32/conf/rootCA.pem" 
</VirtualHost> 

これは61.0にアップデートクローム後に起こるです.3163.79、私はこれがクロムに​​関連しているかどうかは分かりません。

「私の接続はプライベートではありません」と表示される前に、「進む」をクリックして作業を続行できます。

また、chrome://flags/#allow-insecure-localhost、localhostから読み込まれたリソースの無効な証明書を許可しています。 有効
でも同じ質問があります。

私のlocalhost証明書を信頼するその他の操作はできますか?

答えて

1

私はこの問題を解決しました。

ファイルv3.extをopensslと同じルートに作成する必要があります。

ファイル内容:次に

[req] 
distinguished_name = req_distinguished_name 
x509_extensions = v3_req 
prompt = no 
[req_distinguished_name] 
C = TW 
ST = Taiwan 
L = Taipei 
O = CR 
OU = It 
CN = html_12 
[v3_req] 
keyUsage = keyEncipherment, dataEncipherment 
extendedKeyUsage = serverAuth 
subjectAltName = @alt_names 
[alt_names] 
DNS.1=html_12 

&キーCRTファイルを生成するには、コマンドラインを実行します。その後、Apacheの中にファイルを置く

openssl req -new -newkey rsa:2048 -sha256 -days 3650 -nodes -x509 -keyout server.key -out server.crt -config v3.ext -extensions v3_req

を。
これは機能します。

0

あなたが唯一

openssl.conf変更することで、それを解決することができ、元の.csrですし、元の証明書の秘密鍵を持っている場合は、ファイルに以下を追加:

[alt_names] 
DNS.1=html_12 

...もう一度証明書を生成することができます。

openssl x509 -signkey private.key -in request.csr -req -days 365 -out cert-newcert.cer