java.security.NoSuchAlgorithmException: Algorithm x25519 not available

我是研究僧i 提交于 2020-12-06 17:50:09

问题


I am getting a "javax.net.ssl.SSLException: Connection reset" for this piece of code

ReadableByteChannel rbc = Channels.newChannel(url.getInputStream());

but only when running under a Java 14 JRE built with jlink from Open JDK 14. The code executes just fine if I point to the full JDK. I suspect something is missing in the JRE, but what is it and why did jlink not copy the missing files accross? My jlink command based on jdeps is as follows:

"C:\Program Files\Java\jdk-14\bin\jlink.exe" --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules java.base,java.datatransfer,java.desktop,java.logging,java.xml --output %AG14InstallDir%\jre_windows2

Am I missing a module in the jlink? Any ideas or suggestion on how to track this down?

After adding the debug as suggested, I get this output. What do I need to copy across to fix it?

javax.net.ssl|WARNING|2E|Thread-13|2020-06-07 10:22:24.517 UTC|null:-1|Signature algorithm, ed25519, is not supported by the underlying providers
javax.net.ssl|WARNING|2E|Thread-13|2020-06-07 10:22:24.518 UTC|null:-1|Signature algorithm, ed448, is not supported by the underlying providers
javax.net.ssl|WARNING|2E|Thread-13|2020-06-07 10:22:24.519 UTC|null:-1|No AlgorithmParameters for x25519 (
"throwable" : {
  java.security.NoSuchAlgorithmException: Algorithm x25519 not available
    at java.base/javax.crypto.KeyAgreement.getInstance(Unknown Source)
    at java.base/sun.security.ssl.NamedGroup.<init>(Unknown Source)
    at java.base/sun.security.ssl.NamedGroup.<clinit>(Unknown Source)
    at java.base/sun.security.ssl.SignatureScheme.<clinit>(Unknown Source)
    at java.base/sun.security.ssl.SSLSessionImpl.<clinit>(Unknown Source)
    at java.base/sun.security.ssl.TransportContext.<init>(Unknown Source)
    at java.base/sun.security.ssl.TransportContext.<init>(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketImpl.<init>(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
    at java.base/sun.net.www.protocol.https.HttpsClient.createSocket(Unknown Source)
    .............

回答1:


Solved. Need to add jdk.crypto.cryptoki to the --add-modules list in jlink.



来源:https://stackoverflow.com/questions/62238883/java-security-nosuchalgorithmexception-algorithm-x25519-not-available

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!