Re: how to use using client side certifcates?
From: Chris (chris2k01_at_hotmail.com)
Date: 01/31/04
- Next message: mali_djuro: "JDOM and &qout;"
- Previous message: Amey Samant: "Re: Solve the problem....its urgent"
- In reply to: Naresh Agarwal: "how to use using client side certifcates?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 31 Jan 2004 08:14:46 GMT
-----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+aAOknsqwwCfS9Ix
7FRlkeMcy7RfixbxuQvl1bc=
=Ptfp
-----END PGP SIGNATURE-----
- Next message: mali_djuro: "JDOM and &qout;"
- Previous message: Amey Samant: "Re: Solve the problem....its urgent"
- In reply to: Naresh Agarwal: "how to use using client side certifcates?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]