I have a problem with the return value of the KeyStore.aliases () enumeration;
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++; }
C 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 counter
With java version "1.5.0" Java (TM) 2 Runtime Environment, standard version (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 can get all the aliases.
How can I get all store pkcs12 aliases using Sun / Oracle JDK6?
thanks
David source share