INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

SSL connection with PKCS11

SSL connection with PKCS11

(OP)
Hello,
I have an applet that needs to make a SSL connection to an IIS server so that it can upload some files.
The connection needs to use the users smart card.
I'm able to read the card and get the certs but when I try to make the connection I get a "HTTP Error 403.7 - Forbidden: SSL client certificate is required. Internet Information Services (IIS)" error.
Here is a portion of the code.
Can anyone see a problems with it? Also since the user is already connected to the website using their smart card is there away to use the credentials from that connection?

   

CODE

      //I have already set the provider and properties to read
         the smart card
      String aSmartCardPIN="password";
      char[] pin = aSmartCardPIN.toCharArray();
      KeyManagerFactory keyManagerFactory =  
         KeyManagerFactory.getInstance("SunX509");
      // Read the keystore form the smart card
      KeyStore keyStore = KeyStore.getInstance("PKCS11");
      keyStore.load(null, pin);
      //This works, I have verified that the certs from the smart
       card are in the keystore
      //Add to keystore to key manager
      keyManagerFactory.init(keyStore, pin);    
      //Create the context
      SSLContext context = SSLContext.getInstance("SSL");
      context.init(keyManagerFactory.getKeyManagers(), null, new  
        SecureRandom());
       //Create a socket factory
       SSLSocketFactory sf = context.getSocketFactory();
      //Create the socket
      Socket =ret=sf.createSocket(host, port);
      //From here I just make the connection

  
 

RE: SSL connection with PKCS11

Any help here?

Cheers,
Dian

RE: SSL connection with PKCS11

(OP)
Thanks for the link Dian- What they are covering doesn't seem to work but I'll keep look at it.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close