【问题标题】:Can we export certificates from JRE's "cacerts" file and import it to higher JRE version?我们可以从 JRE 的“cacerts”文件中导出证书并将其导入到更高的 JRE 版本吗?
【发布时间】:2020-10-15 08:17:28
【问题描述】:

我正在使用 JRE 8u211。而且我在 cacerts 中添加的证书很少。但是当我将 JRE 升级到 8u261 时,这些证书不会被导入。所以现在我想使用别名以编程方式从 8u211 的 cacerts 文件中导出所需的证书,然后将这些证书导入到 8u261 的 cacerts 文件中。

这是否可能或支持?

提前致谢。

【问题讨论】:

标签: java ssl-certificate cacerts


【解决方案1】:

证书只是一个数据。您绝对可以将其导出到文件中,然后将该数据导入到其他文件中。

如果您只想将一个信任库文件的数据导入另一个信任库文件,您可以直接使用缓冲区,而无需将数据存储到中间文件中:

keytool.exe -importkeystore -srckeystore %JAVA_HOME%\lib\security\cacerts -destkeystore \your\file\path\filename
            -deststoretype jks
            -srcstorepass changeit -deststorepass changeit
            -v -noprompt

不过,这两个操作你也可以一一做:

  1. 导出证书:

    keytool -export -alias alias_name -keystore path_to_keystore_file -rfc -file path_to_certificate_file
    
  2. 导入证书:

    keytool -importcert -alias alias_name -file path_to_certificate_file -keystore truststore_file
    

更多信息请阅读hereherehere

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-17
  • 2019-01-19
  • 2018-03-13
  • 2013-04-04
  • 1970-01-01
  • 2020-06-15
相关资源
最近更新 更多