hi!
i had the same problem and here is the solution for it,
the pfx is a pkcs#12 standard and tho cryptographic tool kit which supports the pkcs#12 standards is the entrust toolkit, so if you are using that toolkit then you have to first get an inputstream from the pfx file get the pkcs12Readerobject, decrypt that object with the password used for the privatekey protection in pfx file. now you get the safebags get the safe bag os private kay and get the private key try this i can also give you the exact code.
Tarun
yes there is:
/**
* Get the private key from a KeyStore in PKCS#12 format (*.PFX created
* by Microsoft IE/OE and others)
*/
public static PrivateKey getPrivateKeyFromPFX(String keyStore, char[] password) {
try {
FileInputStream fis = new FileInputStream(keyStore);
// supported KeyStore types (JDK1.4): PKCS12 and JKS (native Sun)
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(fis, password);
for (Enumeration enum=ks.aliases(); enum.hasMoreElements(); ) {
String alias = (String)enum.nextElement();
if (ks.isKeyEntry(alias)) {
return (PrivateKey)ks.getKey(alias, password);
}
}
} catch (IOException ex) {
log.error(ex);
} catch (Exception ex) {
log.error(ex);
}
return null;
}
Ronald