密钥库不适用于Java 9 [英] Keystore does not work on Java 9

查看:177
本文介绍了密钥库不适用于Java 9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用portecle将JKS密钥库转换为P12格式,但它可能并不顺利。密钥库使用Java 8(各种版本),但使用Java 9(OpenJDK 64位服务器VM(构建9内部+ 0-2016-04-14-195246.buildd.src,混合模式),我得到了

I've converted a JKS keystore to the P12 format using portecle, but it probably didn't go well. The keystore works with Java 8 (various versions), but with Java 9 (OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode), I'm getting

java.io.IOException: Invalid keystore format
        at sun.security.provider.JavaKeyStore.engineLoad(java.base@9-internal/JavaKeyStore.java:659)
        at sun.security.util.KeyStoreDelegator.engineLoad(java.base@9-internal/KeyStoreDelegator.java:219)
        at java.security.KeyStore.load(java.base@9-internal/KeyStore.java:1466)
        at org.eclipse.jetty.util.security.CertificateUtils.getKeyStore(CertificateUtils.java:52)
        at org.eclipse.jetty.util.ssl.SslContextFactory.loadKeyStore(SslContextFactory.java:998)
        at org.eclipse.jetty.util.ssl.SslContextFactory.load(SslContextFactory.java:252)
        at org.eclipse.jetty.util.ssl.SslContextFactory.doStart(SslContextFactory.java:219)

有趣的事情是J ava 8 keytool shows

The funny thing is that Java 8 keytool shows

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 5 entries
... entries listed

而来自Java 9的条目显示

while the one from Java 9 shows

Keystore type: PKCS12
Keystore provider: SUN

Your keystore contains 5 entries
... entries listed

我知道 JEP 229 我已阅读相关问题,但我看不到任何相关问题。

I'm aware of JEP 229 and I've read the related issues, but I can't see any related problem.

推荐答案

JDK keytool实用程序可以将JKS密钥库转换为PKCS12密钥库。
例如,使用JDK 9,

The JDK keytool utility can convert a JKS keystore into a PKCS12 keystore. For example, using JDK 9,

$ keytool -importkeystore -srckeystore ks.jks -destkeystore ks.p12

此外,自2016年以来,已经有几个密钥库增强功能,因此您应该使用更新版本的JDK 9,请参阅 http://jdk.java.net/9/

Also, there have been several keystore enhancements since 2016 so you should use a more recent release of JDK 9, see http://jdk.java.net/9/

这篇关于密钥库不适用于Java 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆