Private key Extracting Problem
843811Feb 6 2007 — edited Feb 14 2007hi all,
i have one PFX certificate and i want to sign document from it for tht i have to get private keys of tht certificate for tht reason i write one code
KeyStore ks = KeyStore.getInstance("PKCS12");
FileInputStream fis = new FileInputStream("bhavin.pfx");
char[] password = {'c','h','a','n','g','e','i','t','\0'};
ks.load(fis, password);
but in this code it gives ine error:::that is::::
java.io.IOException: failed to decrypt safe contents entry: java.io.IOException: getSecretKey failed: Password is not ASCII
and if i giv password as a string and covert it into charcter array using toCharArray().
it gives::::::
KeyStore ks = KeyStore.getInstance("PKCS12");
FileInputStream fis = new FileInputStream("bhavin.pfx");
char[] password = "changeit".toCharArray();
ks.load(fis, password);
it gives::::::::::::
java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPadd
ingException: Given final block not properly padded.
plz help me to store pfx file into keystore.
if u hav proper code to resolve this problem thn plz send me thnx in advance!!!!!