2015-03-31 37 views
0

嗨我試圖在Windows 7中使用來自CA的證書(委託,如果它很重要)配置tomcat7(7.0.50)。我下載了CA根,鏈根和鏈證書文件,以及我的新證書。每tomcat guide,我用我生成來自CSR密鑰庫和執行這些步驟Windows Tomcat7 SSL CA認爲是自簽名

  1. 密鑰工具-import -alias委託-trustcacerts -keystore crush.jks -file entrust.crt.txt

[提示我的證書系統中的寬CA密鑰庫存在,我仍然添加它]

  • 密鑰工具-import -alias鏈根-trustcacerts -keystore crush.jks -file L1Kchainroot。 txt

  • 密鑰工具-import -alias鏈根-trustcacerts -keystore crush.jks -file L1Kchain.txt

  • 密鑰工具-import -alias Tomcat的-trustcacerts -keystore crush.jks -file entrustcert.crt.txt

  • 現在,當我列出我的密鑰庫的內容,我看到

    C:\Users\crush\My Documents\cert>keytool -list -keystore crush.jks 
    Enter keystore password: 
    
    Keystore type: JKS 
    Keystore provider: SUN 
    
    Your keystore contains 5 entries 
    
    entrust, Mar 30, 2015, trustedCertEntry, 
    Certificate fingerprint (SHA1): B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:3 
    
    chain, Mar 30, 2015, trustedCertEntry, 
    Certificate fingerprint (SHA1): CC:A2:7D:33:C7:35:A7:D0:6D:1F:EC:A 
    
    chain-root, Mar 30, 2015, trustedCertEntry, 
    Certificate fingerprint (SHA1): 9E:1A:0C:35:E7:14:B6:97:92:D0:90:B 
    
    tomcat, Mar 30, 2015, trustedCertEntry, 
    Certificate fingerprint (SHA1): 6A:77:EC:32:1E:F9:AC:4F:BE:C7:CB:5 
    
    crush-windows7, Mar 26, 2015, PrivateKeyEntry, 
    Certificate fingerprint (SHA1): 04:72:8A:36:56:7E:D5:0F:7E:E9:E0:1 
    

    現在我編輯的server.xml文件是像這樣

    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" 
          maxThreads="150" scheme="https" secure="true" 
          clientAuth="false" sslProtocol="TLS" sslEnabledProtocols="TLSv1" 
        keystoreFile="C:\Users\crush\apache-tomcat-7.0.50\conf\crush.jks" 
        keystorePass="storepassword" 
        keyPass="keypassword" 
    /> 
    

    當這種靴子了,我瀏覽網頁我會看到一個不受信任的連接警告

    crush-windows7.crush.com:8443 uses an invalid security certificate. The certificate is not trusted because it is self-signed. (Error code: sec_error_ca_cert_invalid) 
    

    如果我使用-v使用keytool並檢查返回的證書,我會看到發行人委託

    Owner: CN=crush-windows7.crush.com, .... 
    Issuer: CN=Entrust Certification Authority - L1K, OU="(c) 2012 Entrust, Inc. - for authorized use only", OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US 
    

    但是我的私人密鑰條目具有發行人自己

    Owner: CN=crush-windows7.crush.com, .... 
    Issuer: CN=crush-windows7.crush.com, .... 
    

    我已經與T搞亂他花了幾個小時,把我的頭靠在牆上,我在使用openssl而不是沒有問題的keytool之前,先用linux做了這個。這可能是我的問題嗎?無論我嘗試使用哪種連接器配置,如果沒有私鑰條目作爲別名和keyPass選項設置,它將不會啓動。如果我刪除了私鑰輸入,它將啓動但永遠不會完成ssl握手。我使用的keyAlias的爲「tomcat」別名,它會說

    java.io.IOException: Alias name tomcat does not identify a key entry 
    

    我能挽救我的當前證書或者我需要生成一個新的私鑰和CSR,並提出新的要求,然後將它們移動到我的Windows機器?我真的覺得這是我的問題,我甚至接近點嗎?對於這個問題,使用Windows並不舒服,感謝您的幫助。

    回答

    0

    您在步驟4中犯了一個小錯誤:您沒有使用Entrust頒發的證書更新您的PrivateKeyEntry,而是將其導入爲可信證書。

    正確的命令會一直:

    keytool -import -alias crush-windows7 -trustcacerts -keystore crush.jks -file entrustcert.crt.txt 
    
    +0

    實際上,它是第4步,但是這是命令。第一步是委託根證書,第四步是我簽署的委託證書。 – Crushing 2015-03-31 11:11:27

    +0

    啊,對,如果不是這樣的話,那將是錯誤的。我已經更新了我的答案。 – Omikron 2015-03-31 11:22:43