[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] Problems decoding a PFX certificate exported from IE5



Hi,

   I've got a problem decrypting a PFX certificate file exported from IE5 
(under win2000 server), and using Java JDK 1.3, the only things in my 
classpath are the jars from iaik, and the jars from Suns Java 1.3. Iam using 
iaik_jce_full.jar. I've seen at the mail list that iam not the only one who 
got these problem. Is it solved doing something?. The exception is :

iaik.pkcs.PKCSException: Unable to decrypt PrivateKey!

   If i verify the PKCS12 before decryption adding this line in code :
        ....
    	PKCS12 MyP12 = new PKCS12(fInput);

        System.out.println("verify: " + MyP12.verify(password));

    	MyP12.decrypt(password);
        ....

i got the following exception:

iaik.pkcs.PKCSException: java.security.NoSuchAlgorithmException: Algorithm 
PKCS#12-MAC not implemented.


What am i doing wrong?.

Best regards,

   Carles.

The code is what follows:

import java.io.*;
import java.security.*;
import java.security.cert.*;

import iaik.pkcs.pkcs12.*;
import iaik.x509.*;


public class SignaXML{

public static void main(String[] args){


	char[] password = "server".toCharArray();

    try{

    	FileInputStream fInput 	= new FileInputStream("c:/certif.pfx");
    	PKCS12 MyP12 = new PKCS12(fInput);

    	MyP12.decrypt(password);

	CertificateBag[] cb = MyP12.getCertificateBags();
        iaik.x509.X509Certificate certif = cb[0].getCertificate();

        KeyBag kb = MyP12.getKeyBag();
        PrivateKey pk = kb.getPrivateKey();

   	}
   	catch (Exception e){
    	String err = e.toString();
    	System.out.println(err);
   	}

}
}
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce