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!

TLS - 2 way authentication with PKCS11 token

user10878887May 15 2011 — edited Oct 17 2011
I try to authenticate to a public server(www.siui.ro:443) using a PKCS11 token.
I use jdk1.6.0_25.
The error is "*main, handling exception: javax.net.ssl.SSLException: Received fatal alert: illegal_parameter*".
This is the code I used:

String configName = "c:/dist/ssl/config/schlumberger.cfg";
Provider p = new sun.security.pkcs11.SunPKCS11(configName);

System.setProperty("java.security.debug", "all");
System.setProperty("javax.net.debug","ssl");

System.setProperty("javax.net.ssl.keyStoreType", "pkcs11");
System.setProperty("javax.net.ssl.keyStore", "NONE");
System.setProperty("javax.net.ssl.keyStorePassword", "******");
System.setProperty("javax.net.ssl.keyStoreProvider", p.getName());
System.setProperty("javax.net.ssl.keyStoreProvider", "SunPKCS11-SmartCard");

Security.addProvider(p);
SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)factory.createSocket("www.siui.ro", 443);
socket.startHandshake();

This is the complete error:

main, WRITE: TLSv1 Handshake, length = 40
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1 ALERT: fatal, illegal_parameter
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLException: Received fatal alert: illegal_parameter
javax.net.ssl.SSLException: Received fatal alert: illegal_parameter
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(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 Client.main(Client.java:52)

Thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 14 2011
Added on May 15 2011
8 comments
5,614 views