
我有一個在 Nginx 和 Apache 中使用的網域的現有 SSL 檔案。
如何keystore
從現有的 GoDaddy .key 和 .crt 檔案建立 tomcat。
我在下面嘗試過
keytool -import -alias tomcat -keystore k.key -file k.crt
我收到以下錯誤
keytool error: java.io.IOException: Invalid keystore format
我了解如何從頭開始創建 SSL,但我需要反轉它, https://in.godaddy.com/help/tomcat-generate-csrs-and-install-certificates-5239
下面編輯的是tomcat ssl配置
<Connector port="${tomcat.ssl.port}"
maxHttpHeaderSize="8192"
maxPostSize="4194304"
maxThreads="150"
protocol="org.apache.coyote.http11.Http11Protocol"
executor="hybrisExecutor"
enableLookups="false"
acceptCount="${tomcat.acceptcount}"
connectionTimeout="20000"
disableUploadTimeout="true"
URIEncoding="UTF-8"
SSLEnabled="true"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol = "TLS"
keystoreFile="/data/ssl/cert/keystore.jks"
keystorePass="123456"
keystoreType="JKS"
keyPass="123456"
/>
答案1
有兩個步驟。首先將其匯出到pkcs12:
openssl pkcs12 -export -in mycert.crt -inkey myprivate.key -certfile mycert.crt -name "mytomcat" -out mykeystore.p12
接下來,使用 keytool 指令建立 jks 檔案:
keytool -importkeystore -srckeystore mykeystore.p12 -srcstoretype pkcs12 -destkeystore keystore.jks -deststoretype JKS