By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

how to use using client side certifcates?

P: n/a
Hi

I'm writing HTTPS client using JDK. I want to perform client side authentication.

1) How can I enable client side authentication in JDK?
2) How should I tell JDK about the client side certificate?

thanks,
Naresh
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Naresh Agarwal wrote:
Hi

I'm writing HTTPS client using JDK. I want to perform client side
authentication.

1) How can I enable client side authentication in JDK?
2) How should I tell JDK about the client side certificate?

thanks,
Naresh


Hi,
I assume you're using javax.net.ssl.HttpsURLConnection. Well, what you
have to do is something like this:

1. Create a new SSLContext using a factory method.
2. Call SSLContext.init(), passing in the key and certificate managers
referring to the authentication data (you might try an X509KeyManager
and X509TrustManager).
3. Call SSLContext.getSocketFactory() to acquire an SSLSocketFactory.
4. Pass this SSLSocketFactory into
HttpsURLConnection.setSSLSocketFactory().
5. Invoke HttpsURLConnection.connect() and go from there.

<<NOTE: Untested!>>

- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAGznFnwjA8LryK2IRAt6xAJ0X2HcQ0UO04SE5MSL3+a AOknsqwwCfS9Ix
7FRlkeMcy7RfixbxuQvl1bc=
=Ptfp
-----END PGP SIGNATURE-----
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.