0

I am encountering a "KeyGenerator not available" error when trying to create a SSL connection using Javax.mail.

The project was functional 3-4 years ago and it was updates to JDK1.8 and to the new JRE. I assume that it's the issue is some fundamental quirk from updating the project.

I've followed everything listed Here.

I added the path from JKD1.8.0_131/jre/lib/ext/sunjce_provider.jar to my project library so that it's both in the JRE library and the project classpath.

java.security.NoSuchAlgorithmException: SunTls12RsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:169) ~[?:1.8.0_131]
at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223) ~[?:1.8.0_131]
at sun.security.ssl.JsseJce.getKeyGenerator(JsseJce.java:251) ~[?:1.8.0_131]
at sun.security.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:78) ~[?:1.8.0_131]
.....

I expected the code to create a connection at this point. What can I do to resolve this issue?

Ex1
  • 1
  • 2

2 Answers2

1

not sure why, but this method helped me in eclipse: https://www.codetd.com/en/article/9438315

Preferences -> installed JREs -> Edit your java 8 JRE and 'Restore Defaults'

Chris
  • 908
  • 6
  • 11
0

You should update Java 8 to the current patchlevel anyway, but according to this issue, you will need at least patch level 192 instead of 131. This is an issue for OpenJDK, but for Oracle Java it seems to be the same.

I assume your code was connecting to a server that has been updated to TLS 1.2 since your last usage.

Jens Dibbern
  • 1,434
  • 2
  • 13
  • 20