Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.security > #144
| From | "Dave Miller" <dave.miller@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Loading keystores fro |
| Message-ID | <OFakk.477$Ht4.473@trnddc01> (permalink) |
| Newsgroups | comp.lang.java.security |
| References | <5bea81f5-d7db-4990-86ea-00b74857dbda@p25g2000hsf.googlegroups.com> |
| Date | 2011-04-27 16:08 +0000 |
| Organization | TDS.net |
To: comp.lang.java.security
Thomaspantalacci311@hotmail.com wrote:
> 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
You've created a keystore and placed one element into it. When you say
"show me elements" it... shows you the one that you've entered.
I've never tried to manipulate the keystore on the client's machine so I
won't be any help there. My sense is that doing so would take a bit of a
hack (or crack). As the keystore holds the keys (literally) to the
client's security, the JVM probably tries to keep it pretty well locked up.
--
Dave Miller
Java Web Hosting at:
http://www.cheap-jsp-hosting.com/
---
* 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 | Next — Previous in thread | Next in thread | Find similar
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