Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / April 2004

Tip: Looking for answers? Try searching our database.

Need help accessing Certificates (SSL)

Thread view: 
Bleedledeep - 14 Apr 2004 14:40 GMT
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 - 15 Apr 2004 10:14 GMT
> Guess I need some hand holding :(
>
[quoted text clipped - 13 lines]
>
> 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
Signature

Rogan Dawes
nntp_AT_dawes*DOT*za-DOT-net



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.