Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Another RSA premaster secret error

843811Dec 22 2007 — edited Aug 6 2009
I'm having trouble trying to runing a litle applet.
I'm using Java 6 on Unbuntu 64bits. Should I report a bug?

Java Plug-in 1.6.0_03
Using JRE version 1.6.0_03 Java HotSpot(TM) Client VM
User home directory = /home/andre
network: Loading user-defined proxy configuration ...
network: Done.
network: Loading proxy configuration from Netscape Navigator ...
network: Reading user preference file from /home/andre/.mozilla/default/fdvsc59r.slt/prefs.js
network: Done.
network: Loading browser proxy configuration ...
network: Done.
network: Proxy Configuration: Browser Proxy Configuration


----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

basic: New window ID: e01ab4
basic: Value of xembed: 1
basic: setWindow: call before applet exists:e01ab4
security: Accessing keys and certificate in Mozilla user profile: /home/andre/.mozilla/default/fdvsc59r.slt
security: JSS package is not found
security: JSS is not configured
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@1ee3914, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@3eca90
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: completed perf rollup
network: Cache entry not found [url: https://www2.bancobrasil.com.br/aapf/ncresp/teclado/BBTeclado013.jar, version: null]
network: Connecting https://www2.bancobrasil.com.br/aapf/ncresp/teclado/BBTeclado013.jar with proxy=DIRECT
security: Loading Root CA certificates from /usr/lib/jvm/ia32-java-6-sun-1.6.0.03/jre/lib/security/cacerts
security: Loaded Root CA certificates from /usr/lib/jvm/ia32-java-6-sun-1.6.0.03/jre/lib/security/cacerts
security: Loading SSL Root CA certificates from /usr/lib/jvm/ia32-java-6-sun-1.6.0.03/jre/lib/security/cacerts
security: Loaded SSL Root CA certificates from /usr/lib/jvm/ia32-java-6-sun-1.6.0.03/jre/lib/security/cacerts
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Checking if certificate is in Deployment denied certificate store
network: Cache entry not found [url: https://www2.bancobrasil.com.br/aapf/ncresp/teclado/br/com/bb/aapf/bbteclado/CampoTeclado.class, version: null]
network: Connecting https://www2.bancobrasil.com.br/aapf/ncresp/teclado/br/com/bb/aapf/bbteclado/CampoTeclado.class with proxy=DIRECT
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Checking if certificate is in Deployment denied certificate store
network: Cache entry not found [url: https://www2.bancobrasil.com.br/aapf/ncresp/teclado/br/com/bb/aapf/bbteclado/CampoTeclado/class.class, version: null]
network: Connecting https://www2.bancobrasil.com.br/aapf/ncresp/teclado/br/com/bb/aapf/bbteclado/CampoTeclado/class.class with proxy=DIRECT
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Checking if certificate is in Deployment denied certificate store
load: class br/com/bb/aapf/bbteclado/CampoTeclado.class not found.
java.lang.ClassNotFoundException: br.com.bb.aapf.bbteclado.CampoTeclado.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:780)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2074)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:709)
at sun.applet.AppletPanel.run(AppletPanel.java:363)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:97)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:574)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:197)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:405)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:284)
at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:44)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:173)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
... 9 more
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(JsseJce.java:223)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:89)
... 27 more
basic: Exception: java.lang.ClassNotFoundException: br.com.bb.aapf.bbteclado.CampoTeclado.class

Comments

800485
First, try cleaning your java cache
Second, try changing the SSL/TLS parameters in the java panel (I don't know where you find that on Ubuntu)
843811
I have the same problem, how have you managed to fix it?
EJP
Have a good look at the exception trace:
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(JsseJce.java:223)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:89)
... 27 more
basic: Exception: java.lang.ClassNotFoundException: br.com.bb.aapf.bbteclado.CampoTeclado.class
Something is not installed.
843811
But, this only happens to my with jre1.6.0_06, it works fine with jre1.5.0_10, and i don't have any java.lang.ClassNotFoundException.

I've tried to copy sunjce_provider.jar into my lib directory, but it does not work.


Any ideas?

Thanks
EJP
i don't have any java.lang.ClassNotFoundException.
Then you don't have the same problem, you have a different problem, so you should post your own stack trace. In your own thread.
I've tried to copy sunjce_provider.jar into my lib directory, but it does not work.
It's been puzzling me for decades why people think copying files all over the place will work. Software has to be installed.
843811
Sorry, I do not properly explain. What he did was establish in the classpath, as follows:

...
set CLASSPATH=%CLASSPATH%;.\libs\sunjce_provider.jar
...

(although i know that if it is in the java\jre\lib\ext is also in the classpath ...)

My stack trace is:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.net.ssl.SSLKeyException: RSA premaster secret error
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:213)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:157)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:114)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
at org.apache.axis.client.Call.invokeEngine(Call.java:2526)
at org.apache.axis.client.Call.invoke(Call.java:2515)
at org.apache.axis.client.Call.invoke(Call.java:1715)
at es.myClass.webservices.myClassWebService.invoke(Unknown Source)
at es.myClass.webservices.myClassWebService.invoke(Unknown Source)
at ClientWS.DatosUsuario.obtenerDatos(Unknown Source)
at ClientWS.DatosUsuario.<init>(Unknown Source)
at ClientWS.VentanaPrincipal.main(Unknown Source)
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(Unknown Source)
... 24 more


javax.net.ssl.SSLKeyException: RSA premaster secret error
at org.apache.axis.AxisFault.makeFault(AxisFault.java:129)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:131)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
at org.apache.axis.client.Call.invokeEngine(Call.java:2526)
at org.apache.axis.client.Call.invoke(Call.java:2515)
at org.apache.axis.client.Call.invoke(Call.java:1715)
at es.myClass.webservices.myClassWebService.invoke(Unknown Source)
at es.myClass.webservices.myClassWebService.invoke(Unknown Source)
at ClientWS.DatosUsuario.obtenerDatos(Unknown Source)
at ClientWS.DatosUsuario.<init>(Unknown Source)
at ClientWS.VentanaPrincipal.main(Unknown Source)
Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:213)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:157)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:114)
... 12 more
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(Unknown Source)
... 24 more


Perhaps I need to upgrade axis?
The line where it fails is:

v = call.invoke(env).getBodyElements();

I dont know what to do more...

Thanks
EJP
The answer is the same as it was on Saturday 31/05/2008 09:45 (reply 3 of 6). Something is not installed.

And I still don't know what is meant by all this stuff with the JAR file.

If you are running a Sun JDK or JRE, the Sun JCE provider is already installed in the correct place, if your JDK/JRE is correctly installed. If you aren't, getting it from somewhere, presumably a machine with a JDK/JRE where it is installed, and putting it somewhere else on another machine doesn't constitute installing it.

Copying JAR files or messing around with the classpath != installing. You are only making the problem worse.

I would reinstall the JRE.
843811
Thanks for the reply;

I have done what you said. I have deleted the JRE 1.6 and reinstall JRE 1.5, and it works fine. Then, I deteled the JRE 1.5 and reinstall 1.6, and ... now i have the same error, so i think that there are something diferent between this two versions...


I keep trying

thanks again
843811
fwiw, I get the EXACT same error in a different context when loading a java applet requiring authentication. I have 2 machines, one 64-bit and the other 32-bit, both with ubuntu 8.04 and sun-java6. [EDIT:My applets work on the 32-bit machine and generate the "RSA premaster secret error" on the 64-bit machine]. I suspect this is a 64-bit issue, and I have no clue whether it's on the sun side or in the ubuntu libraries someplace. Note that for both of my setups that jce.jar and jsse.jar are IDENTICAL. I am neither a java expert nor a linux developer, but I thought this observation might point someone to resolve this problem.

Edited by: krudman on Jul 14, 2008 6:35 PM - left out important info
843811
Make sure there are 4 jar files (dnsns.jar, localedata.jar, sunjce_provider.jar and sunpkcs11.jar) under $JAVA_HOME/jre/lib/ext. If you installed a jdk, these jars should be there by default.
One more possibility could be that you messed up with Djava.ext.dirs. Be default, Djava.ext.dirs is set to $JAVA_HOME/jre/lib/ext; if you try to set it to something else (sometimes developers use Djava.ext.dirs to point to their local jar files), then you will definitely get the above error. The only way to fix this issue is to append your jar files directory path to the default Djava.ext.dirs path.
843811
My code was having -Djava.ext.dirs parameter set to some other directory. Removing it has resolved this issue for me.

Make sure your application is not pointing to any other directory then the defaul java external directory which contains all jars related to SSL.

Hope this will solve most of the problem.

Thanks.
1 - 11
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 3 2009
Added on Dec 22 2007
11 comments
23,296 views