I am programatically loading a certificate into a default keystore with the following code

```
KeyStore kStore = KeyStore.getInstance(KeyStore.getDefaultType());
java.io.FileInputStream fis = new FileInputStream(keystorePath);
kStore.load(fis, new String(keystorePass).toCharArray());
fis.close();

```

I have a certificate from a third party in pfx format. If I try to load it, it fails with invalid format. 

If I update to use the following it works. But I don't want to change the code. 

```
KeyStore keystore = KeyStore.getInstance("PKCS12");  

```

How can I convert the pfx file to a format that will be accepted by the following

```
KeyStore kStore = KeyStore.getInstance(KeyStore.getDefaultType());    

```