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

[iaik-jce] No private key when importing PKCS file into IIS


The subject says it all really. I have created an RSA private key
and have received a certificate.

I import these (to create a keystore) and then create a PKCS12 object
that I then save to a file.

I then import this file into Windows2000 using the certificate manager and
everthing works OK. The problem is that the private key is no longer
attached to the certificate and is therefore useless to IIS.

Is there something I'm doing wrong here. Here is the code that
exports the PKCS12 object:

                CertificateBag[] certBags = new CertificateBag[chain.length];

                 byte[] keyId = new byte[] {0x01, 0x02, 0x03, 0x04};
                 KeyBag keyBag = new KeyBag(privateKey, "Joe Bloggs", keyId);

                 certBags[0] = new CertificateBag(chain[0]);
                 certBags[0].setFriendlyName("Joe Bloggs");

                 PKCS12 test_write = new PKCS12(new KeyBag(privateKey), 
certBags, true);


                 OutputStream os;
                 os = new FileOutputStream(KEYSTORE_DEFAULT_DIR + 


Relate AB, Tegnérgatan 3, S-111 40 Stockholm
Tel: +46 (8) 454 18 80
Mobile: +46 (709) 679 250
Framtidens IT-konsulter - Morgondagens lösningar!

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