【问题标题】:Import cert to java application将证书导入 java 应用程序
【发布时间】:2018-05-11 22:42:45
【问题描述】:

接下来尝试向 java 添加证书: How to import a .cer certificate into a java keystore?

$ keytool -importcert -file ../test_cert -keystore keystore.jks -alias "Alias"

Trust this certificate? [no]:  yes
Certificate was added to keystore

检查创建的密钥库:

$ keytool -keystore keystore.jks -list -storepass changeit
Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

alias, 11.05.2018, trustedCertEntry, 
Certificate fingerprint (SHA1): A9:8B:25:AE:01:E8:92:CF:25:D6:F6:E0:8E:BC:49:87:11:8B:B5:92

然后运行我的 java 应用程序:

./java/bin/java -Djavax.net.ssl.keyStore=keystore.jks -Djavax.net.ssl.keyStorePassword=changeit -Djavax.net.debug=all -jar Application.jar

мая 11, 2018 12:27:46 PM com.application.main.logic.classloader.JarsForPackagesContainer importJarsFromPath
INFO: JarClassLoader: import from [Application.jar]
мая 11, 2018 12:27:46 PM com.application.main.service.manager.ApplicationRuntimeManager <clinit>
INFO: Started at 2018-05-11 12:27:46

adding as trusted cert:
  Subject: CN=Go Daddy Root Certificate Authority - G2, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US
  Issuer:  OU=Go Daddy Class 2 Certification Authority, O="The Go Daddy Group, Inc.", C=US
  Algorithm: RSA; Serial number: 0x1be715
  Valid from Wed Jan 01 09:00:00 EET 2014 until Fri May 30 10:00:00 EEST 2031

adding as trusted cert:
  Subject: CN=RapidSSL CA, O="GeoTrust, Inc.", C=US
  Issuer:  CN=GeoTrust Global CA, O=GeoTrust Inc., C=US
  Algorithm: RSA; Serial number: 0x236d1
  Valid from Sat Feb 20 00:45:05 EET 2010 until Wed Feb 19 00:45:05 EET 2020

当应用程序启动时,我看不到我的证书,只有其他人。

如何将证书添加到 java 应用程序以及在哪里可以找到已在使用的证书?

【问题讨论】:

  • “我看不到我的证书”你是如何检查它的?邮政编码
  • Run in -Djavax.net.debug=all 查看终端中的其他证书,但不是我的。更新请求

标签: java


【解决方案1】:

trustcacerts 存在问题,该文件位于 jar 存档中。 因此,我从 jar 导入我的证书获取此文件,然后将其移回并启动应用程序。

【讨论】:

    猜你喜欢
    • 2017-05-06
    • 2018-12-23
    • 1970-01-01
    • 1970-01-01
    • 2011-02-06
    • 1970-01-01
    • 2010-10-21
    • 2014-02-12
    • 2011-07-07
    相关资源
    最近更新 更多