SunMSCAPI more certificates with the same alias problem

Hi all,

I get the JDK 1.6.0 Beta and try to use new SunMSCAPI to work with certificates and keys from MS Crypto API. I have three private certificates from three different certificate authorities in my "MY" store. I read the certificates with this code:

KeyStore store = KeyStore.getInstance("Windows-MY");

Vector certificateVector =new java.util.Vector();

for (java.util.Enumeration e = store.aliases(); e.hasMoreElements();){

String alias = (String) e.nextElement();

X509Certificate cert = (X509Certificate) store.getCertificate(alias);

if (!store.isKeyEntry(alias))

continue;

certificateVector.add(certAlias);

}

My three certificates has the same alias and getting the certificate with getCertificate method returns the first certificate only.

So my question is - how is it possible to enumerate and read those certificates with the same alias from KeyStore?

Thanks.

[1171 byte] By [DrLika] at [2007-10-3 8:11:25]
# 1
Have you tried changing the Friendly Name (alias) of the certificates using the Windows certificate viewer tool or certmgr.msc and then running your code? (I'm surprised that it allows the same Friendly Name for three different certificates - I must verify that sometime)
arshad.noora at 2007-7-15 3:15:58 > top of Java-index,Security,Cryptography...
# 2
Similar product, opensourceCryptoAPI Provider for JavaPart of the websign project at http://rcardon.free.fr/websign
RCardona at 2007-7-15 3:15:58 > top of Java-index,Security,Cryptography...