File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes Connect SSL with client Certificate using java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Connect SSL with client Certificate using java code" Watch "Connect SSL with client Certificate using java code" New topic
Author

Connect SSL with client Certificate using java code

Bharat Kasodariya
Ranch Hand

Joined: Aug 19, 2011
Posts: 36
Hi,

My server is ssl enabled with client authentication. I have client certificate in pfx format. I installed certificate in browser so i am able connect from browser. I want to connect same thing using java code.
Can anybody tell me how to connect ssl enabled server using client certificate with JAVA code.

Thanks,
Bharat
Arshad Noor
Ranch Hand

Joined: Oct 06, 2011
Posts: 34
I would recommend studying the programming examples of the JSSE; this code helps you establish an SSL session with a remote SSL server. The Client Authentication is merely an additional step in the session establishment process. I would recommend converting the PFX file (using keytool) to a JKS file. This will make it a little easier to work with the Java code since you can access and manipulate the JKS file directly with keytool on the command line. Otherwise, you'll have to constantly remember that the PFX is a PKCS12 file, and indicate this in your code as well as keytool commands.

Hope that helps.

Arshad Noor
StrongAuth, Inc.
Bharat Kasodariya
Ranch Hand

Joined: Aug 19, 2011
Posts: 36
Thanks Arshad.

I found the way to read pkcs12 certificate in java using JCE.

Thanks,
Bharat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connect SSL with client Certificate using java code
 
Similar Threads
SSL-Jboss with no certificate
regarding SSL client program
Server Socket :Unable to make connection
certificate to establish a secured connection(SSL)
Weblogic SSL certificate