Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
447 views
in Technique[技术] by (71.8m points)

spring boot - Keystore was tampered with, or password was incorrect - Java Springboot app

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

question from:https://stackoverflow.com/questions/65854646/keystore-was-tampered-with-or-password-was-incorrect-java-springboot-app

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...