0

I have existing SSL file for a domain which being used in Nginx and Apache.

How I can create tomcat keystore from existing GoDaddy .key and .crt file.

I tried below

keytool -import -alias tomcat -keystore k.key -file k.crt

I got below error

keytool error: java.io.IOException: Invalid keystore format

I got below how to create SSL from scratch, but I need reverse it, https://in.godaddy.com/help/tomcat-generate-csrs-and-install-certificates-5239

Edit below is tomcat ssl config

<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"
/>
2

There are two steps. First export it to pkcs12:

openssl pkcs12 -export -in mycert.crt -inkey myprivate.key -certfile mycert.crt -name "mytomcat" -out mykeystore.p12

Next, use the keytool command to create the jks file:

keytool -importkeystore -srckeystore mykeystore.p12 -srcstoretype pkcs12 -destkeystore keystore.jks -deststoretype JKS

  • Looks it will work, will give try on weekends, – Ramratan Gupta Feb 16 '18 at 15:22
  • I tried, now getting SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-9002"] java.io.IOException: Keystore was tampered with, or password was incorrect i have used same password for source and destination. – Ramratan Gupta Feb 18 '18 at 2:53
  • now I can not start server with old config, – Ramratan Gupta Feb 18 '18 at 3:44
  • I think I have done something wrong with passwords, I will try with default keystore password. – Ramratan Gupta Feb 19 '18 at 5:37
  • xacmlinfo.org/2014/06/13/… – Ramratan Gupta Feb 21 '18 at 14:06

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.