How to know keystore type

1k views Asked by At

I'm in the process of WS security. In my application user may give JKS file or PK12 file. I load the keystore file using the following code,

KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(inStream, "pass".toCharArray());

It is throwing Invalid keystore format

  • So is there any way to find if the file is JKS or PK12 or any other else?
  • Should I get it from the user what kind of file he is using?

I'm new to this, correct me if my understanding is wrong. I apology for wasting your time, if this is duplicate.

0

There are 0 answers