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

1 Answer 1

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

5
  • Looks it will work, will give try on weekends, Commented Feb 16, 2018 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. Commented Feb 18, 2018 at 2:53
  • now I can not start server with old config, Commented Feb 18, 2018 at 3:44
  • I think I have done something wrong with passwords, I will try with default keystore password. Commented Feb 19, 2018 at 5:37
  • xacmlinfo.org/2014/06/13/… Commented Feb 21, 2018 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .