我有一个Java应用程序(通过批处理文件运行)。应用程序连接到我们使用证书的服务器。
现在服务器证书发生了变化,我们将其导入Java密钥库。
现在,在我们使用JRE1.7运行它之后,应用程序运行正常,但是使用JRE 1.8,我们得到以下异常。有人可以帮忙。
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
答案 0 :(得分:-1)
从PasteBin链接中的完整堆栈跟踪,这是根本原因:
Caused by: java.security.cert.CertificateException: java.security.InvalidKeyException: PublicKey algorithm not implemented: ECPublicKey
at iaik.x509.X509Certificate.c(Unknown Source) ~[iaik_jce_full-3.18.1.jar:3.181]
at iaik.x509.X509Certificate.decode(Unknown Source) ~[iaik_jce_full-3.18.1.jar:3.181]
at iaik.x509.X509Certificate.<init>(Unknown Source) ~[iaik_jce_full-3.18.1.jar:3.181]
at iaik.x509.CertificateFactory.engineGenerateCertificate(Unknown Source) ~[iaik_jce_full-3.18.1.jar:3.181]
at java.security.cert.CertificateFactory.generateCertificate(Unknown Source) ~[na:1.8.0_161]
at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source) ~[na:1.8.0_161]
at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source) ~[na:1.8.0_161]
at sun.security.provider.KeyStoreDelegator.engineLoad(Unknown Source) ~[na:1.8.0_161]
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(Unknown Source) ~[na:1.8.0_161]
at java.security.KeyStore.load(Unknown Source) ~[na:1.8.0_161]
at sun.security.ssl.TrustManagerFactoryImpl.getCacertsKeyStore(Unknown Source) ~[na:1.8.0_161]
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.getTrustManagers(Unknown Source) ~[na:1.8.0_161]
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.<clinit>(Unknown Source) ~[na:1.8.0_161]
at sun.security.ssl.SSLContextImpl$DefaultSSLContext.<init>(Unknown Source) ~[na:1.8.0_161]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_161]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_161]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.8.0_161]
... 22 common frames omitted
您可以粘贴用于创建密码的代码吗?我想您可能需要将其更改为使用SunJCE。
这样的事情:
Cipher cipher = Cipher.getInstance("AES/CTR/NoPadding","SunJCE");
当我看到你如何初始化事物时,我只能肯定地说。