Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Private key Extracting Problem

843811Feb 6 2007 — edited Feb 14 2007
hi 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!!!!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2007
Added on Feb 6 2007
3 comments
342 views