简体   繁体   English

密钥库和信任库不一起工作

[英]keystore and trustore not working together

I have an existing application with configured trustore to connect to ldap 我有一个配置了trustore的现有应用程序,可以连接到ldap

java -Djavax.net.ssl.trustStore=config/keystore.jks 
     -Djavax.net.ssl.trustStorePassword=p@ssw0rd -jar test.jar

Then I want the application to configure to use https. 然后,我希望应用程序配置为使用https。 I use a separately generated keystore for this. 我为此使用了单独生成的密钥库。 Since I am using spring boot, I added the following: 由于我使用的是Spring Boot,因此添加了以下内容:

java -Djavax.net.ssl.trustStore=config/keystore.jks 
     -Djavax.net.ssl.trustStorePassword=p@ssw0rd 
     -Dserver.ssl.key-alias=kstore2 
     -Dserver.ssl.key-store=config/kstore2.keystore 
     -Dserver.ssl.key-store-password=kstore2
     -jar test.jar

When I run, I am getting the following error: 运行时,出现以下错误:

java.io.FileNotFoundException: 
C:\Users.....\AppData\Local\Temp\tomcat.5....\config\keystore.jks 
(The system cannot find the path specified).

If I run only with -Djavax.net....., it's working but I am back to http. 如果仅使用-Djavax.net .....运行,它可以工作,但我会返回http。 If I run only with -Dserver.ssl...., it's working and I can get https. 如果我仅与-Dserver.ssl ....一起运行,则可以正常运行,并且可以获取https。 But if I run with them together, I got the error. 但是如果我和他们一起跑步,我会得到错误。

You are using a relative path for the trust store and key store. 您正在使用信任库和密钥库的相对路径。 Are you sure the key store is located under the config directory where you are starting your application? 您确定密钥库位于启动应用程序的config目录下吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM