2

I know this question has been asked multiple times but I still can't seem to get around it. I'm trying to connect to Azure-SQL db from my SpringBoot app and keep running into this error :

Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:783) ~[na:1.8.0_251]
Caused by: java.security.UnrecoverableKeyException: Password verification failed

I've a rapidssl.jks file that I'm adding to the app's VM args to get past something similar to "PKIX path building failed" and "unable to find valid certification path to requested target"

I'm on MacBook and have tried to create a self signed certificate using:

sudo keytool -export -keystore rapidssl-36.1.2.jks -file selfsign.crt 

and importing it using: sudo keytool -import -keystore "cacerts" -file "/Users/Documents/cert/selfsign.crt" -alias rapidssl running in /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/security directory. I completed those steps but still can't get past the error. Any suggestions/recommendations?

I'm on Java 8 (zulu jdk), SpringBoot: 2.0.4-RELEASE, MacBook OS Catalina 10.15.7

linuxNoob
  • 600
  • 2
  • 14
  • 30

2 Answers2

1

The quotes in your command seem to be the issue:

sudo keytool -import -keystore "cacerts" -file "/.../selfsign.crt" ...

The keystore cacerts, as well as the file shouldn't be in between quotes.

You already execute it on the right path (jre/lib/security), so try this:

sudo keytool -import -keystore cacerts -file /.../selfsign.crt -alias rapidssl

An example of the keytool command:

enter image description here

aran
  • 10,978
  • 5
  • 39
  • 69
  • I get certificate already exists under the alias message followed by Do you still want to add it? I input yes and it said certificate aded to keystore but the error remains. – linuxNoob Jan 23 '21 at 01:54
1

Add all of the below properties:

  1. server.ssl.key-store
  2. server.ssl.key-store-type=JKS
  3. server.ssl.key-store-password
  4. server.ssl.key-alias
  5. server.ssl.key-password
  • thanks for your answer, please edit and add more details, for example where these properties should be added into. That would complete the answer and guide in fixing the issue. – Marco Tizzano Apr 29 '21 at 19:08