Home > Archive > Java Security > April 2004 > Need help accessing Certificates (SSL)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Need help accessing Certificates (SSL)
|
|
| Bleedledeep 2004-04-14, 10:43 am |
| Guess I need some hand holding :(
I am trying to programmatically access a web page that requires a
username/password and uses SSL with some sort of certificate. (No,
I'm not doing anything bad)
I know the certificate is somewhere within the keystore IE is
accessing.
I have been reading/searching this group and other usenet/web stuff
and cannot figure out how to use these keys in my java app. I've
written quite a few things trying to make this work, but can't seem to
get the cert imported into a key factory I can use.
What I need to know is:
1. Under what format should I export the certificate from IE?
2. How do I load that cert into a key factory I can use from Java?
3. I suspect there is no answer to this, but is there any way other
than trial and error to figure out which of the certificates in the IE
store the web page is using?
| |
| Rogan Dawes 2004-04-15, 6:34 am |
| Bleedledeep wrote:
> Guess I need some hand holding :(
>
> I am trying to programmatically access a web page that requires a
> username/password and uses SSL with some sort of certificate. (No,
> I'm not doing anything bad)
>
> I know the certificate is somewhere within the keystore IE is
> accessing.
>
> I have been reading/searching this group and other usenet/web stuff
> and cannot figure out how to use these keys in my java app. I've
> written quite a few things trying to make this work, but can't seem to
> get the cert imported into a key factory I can use.
>
> What I need to know is:
>
> 1. Under what format should I export the certificate from IE?
PKCS12 is good, and the standard Java classes can read it (1.4.2 can,
for sure, maybe earlier)
> 2. How do I load that cert into a key factory I can use from Java?
I'm using the following code to set up an SSLSocket Factory with my
client certificate loaded into it.
private SSLSocketFactory getFactory() throws Exception {
SSLContext sc = SSLContext.getInstance("SSL");
KeyManagerFactory kmf =
KeyManagerFactory.getInstance("SunX509");
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(
new FileInputStream("exported key.p12"),
"keyStorePassword");
kmf.init(ks, "keyPassword");
sc.init(
kmf.getKeyManagers(),
_null,
new SecureRandom());
return (SSLSocketFactory)sc.getSocketFactory();
}
> 3. I suspect there is no answer to this, but is there any way other
> than trial and error to figure out which of the certificates in the IE
> store the web page is using?
Can't help you there. Sorry.
Regards,
Rogan
--
Rogan Dawes
nntp_AT_dawes*DOT*za-DOT-net
|
|
|
|
|