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

AW: [iaik-jce] PKCS exception



Hello,

I have tried your sample and it works for me. Perhaps there is an issue with
the certificates,  private key supplied.

The exception message you are describing seems to only may appear during a
decoding/parsing phase and not during encryption. What version of IAIK-JCE
are you using?

Regards,
Dieter Bratko

-----Ursprüngliche Nachricht-----
Von: iaik-jce-owner@iaik.tu-graz.ac.at
[mailto:iaik-jce-owner@iaik.tu-graz.ac.at]Im Auftrag von Carvalho, R.F.
de
Gesendet: Mittwoch, 18. Oktober 2000 14:05
An: 'Iaik Support'
Betreff: [iaik-jce] PKCS exception


Hi,

 I want to generate a PKCS #12 to read x509certificates, generated by my
 java code, in Netscape browser.
 I write the following code:

 private void encodePKCS12(iaik.x509.X509Certificate[] cert, PrivateKey
privK, String
 passwd) {
     try {
       KeyBag keyBag = new KeyBag(privK);
       CertificateBag[] certBags = new CertificateBag[1];
       certBags[0] = new CertificateBag(cert[0]);

       PKCS12 pkcs12 = new PKCS12(keyBag, certBags, false);
       pkcs12.encrypt(passwd.toCharArray());
       pkcs12.writeTo(new FileOutputStream("kpn.p12"));
    } catch (Exception ex) {
       ex.printStackTrace();
     }
 }

 But when the method encrypt is performed I have the following exception:

 iaik.pkcs.PKCSException: Next tag no OCTET STRING!
        at iaik.pkcs.pkcs12.AuthenticatedSafe.<init>(AuthenticatedSafe.java)
        at iaik.pkcs.pkcs12.PKCS12.encrypt(PKCS12.java)
        at x509main.encodePKCS12(x509main.java:224)
        at x509main.<init>(x509main.java:49)
        at x509main.main(x509main.java:63)

Does some one have a clue on it?

Thanks,

Rodrigo

--
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



--
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