Open scop opened 7 years ago
I'm not sure what you mean by checking STORE_VERSION. Is there an API for doing that available?
FWIW, I think BC should just tell us the correct type when asked with KeyStore.getType; currently it always says BKS no matter if the store was created as BKS or BKS-V1. That way things would just work. Could you file a BC bug about this?
Original comment by: scop
I have to correct myself: Version 0 is of course not BKS_V1. Version 1 is correct. To check the store version of a BKS keystore just open a DataInputStream of the keystore and read the first int. It contains the version. 1 is for BKS_V1 and higher is BKS.
Examplecode: DataInputStream dis = new DataInputStream(Test.class.getClassLoader().getResourceAsStream("certstore.bks")); int storeVersion = dis.readInt(); if(storeVersion == 1) { System.out.println("BKS_V1 keystore"); } else { System.out.println("BKS keystore with store version " + storeVersion); }
Original comment by: redirion
I don't think I want to embed this low level details about key store formats inside Portecle. Having BC just tell us what it has would be the preferable approach.
Original comment by: scop
Steps to reproduce:
Maybe there is a missing check of the STORE_VERSION. Version 0 for BKS_V1, higher for BKS.
Reported by: redirion