Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.security > #143

Re: Loading keystores fro

From "Thomaspantalacci311" <thomaspantalacci311@THRWHITE.remove-dii-this>
Subject Re: Loading keystores fro
Message-ID <5bea81f5-d7db-4990-86ea-00b74857dbda@p25g2000hsf.googlegroups.com> (permalink)
Newsgroups comp.lang.java.security
References <zoZjk.414$wS4.50@trnddc03>
Date 2011-04-27 16:08 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.security
I had an other question, but i couldn't found any response. I have two
certificates in my smartcard. How can i load the both certificates.
I tryed this code

char[] pin = smartCardPIN.toCharArray();
KeyStore keyStore = null;
try{
     keyStore = KeyStore.getInstance("PKCS11");//
}catch(Exception e){
     e.printStackTrace();
}
keyStore.load(null, pin);
Enumeration aliases = keyStore.aliases();
if (aliases.hasMoreElements()) {
     String alias = (String)aliases.nextElement();
     System.out.println("alias:"+alias);
     //getting the certificate chain and the private key
     Certificate[] certificationChain =
keyStore.getCertificateChain(alias);
     PrivateKey privateKey = (PrivateKey) keyStore.getKey(alias,
null);
     ....

}

...


But aliases enumeration has only one element, since it prints
"Signature certificate" (the alias of my signature certificate)
It seems that the other certificate is not loaded. Maybe i must
instantiate a new keystore ?
Maybe the problem (if it's a problem) is due to my pkcs11 provider. Do
you have any suggestion?
Thanks for your answers

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.security | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Loading keystores fro "Dave Miller" <dave.miller@THRWHITE.remove-dii-this> - 2011-04-27 16:08 +0000
  Re: Loading keystores fro "Thomaspantalacci311" <thomaspantalacci311@THRWHITE.remove-dii-this> - 2011-04-27 16:08 +0000
    Re: Loading keystores fro "Dave Miller" <dave.miller@THRWHITE.remove-dii-this> - 2011-04-27 16:08 +0000
      Re: Loading keystores fro "Thomaspantalacci311" <thomaspantalacci311@THRWHITE.remove-dii-this> - 2011-04-27 16:08 +0000

csiph-web