I've a problem with the enum return value of KeyStore.aliases();
FileInputStream is = new FileInputStream("/tmp/file.p12");
List<String> aliases = new ArrayList<String>();
KeyStore keystore = KeyStore.getInstance("PKCS12");
keystore.load(is, password.toCharArray());
is.close();
Enumeration<String> e=keystore.aliases();
while(e.hasMoreElements()) {
// never reaches here because "e" is empty
System.out.println(e.nextElement().toString());
i++;
}
With Java version "1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04) Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
I get an empty enumerator
With java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build pxi32devifx-20100511a (SR11 FP2 )) IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223ifx-20100510 (JIT enabled) J9VM - 20100509_57823_lHdSMr JIT - 20091016_1845ifx7_r8 GC - 20091026_AA) JCL - 20100511a
I am able to get all the aliases.
How can I retrieve all the store pkcs12 aliases with Sun/Oracle JDK6?
Thanks
Keystore.getProvider()) in both cases? - martijno