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

FW: [iaik-jce] Loading RSAPrivateKey from DER





Sorry! 

I found it (don't you hate it when that happens 30 seconds after doing a
posting 8) I now do:

   ASN1 asn1= new ASN1(new FileInputStream("certs/key.der"));
   RSAPrivateKey privateKey= RSAPrivateKey.parse(asn1.toByteArray());

Cheers,

David

-----Original Message-----
From: David.Harrison@dresdnerkb.com
[mailto:David.Harrison@dresdnerkb.com]
Sent: 07 February 2001 13:28
To: iaik-jce@iaik.tu-graz.ac.at
Subject: [iaik-jce] Loading RSAPrivateKey from DER



Hello,

I have a server certificate key in a DER encode file, here's a snipped of my
test application:

   RSAPrivateKey privateKey= RSAPrivateKey.parse(asn1.toByteArray());

	switch (asn1.getFormat()) {
		case ASN1.PEM:
			System.err.println("ANS1 Format : PEM");
			break;
		case ASN1.DER:
			System.err.println("ANS1 Format : DER");
			break;
		default:
			System.err.println("ANS1 Format : Huh?");
			break;
	}

	RSAPrivateKey privateKey= new RSAPrivateKey(asn1.toASN1Object());

When I run this, I get :

	ANS1 Format : DER
	Unexpected error:
	java.security.InvalidKeyException: No PrivateKeyInfo:
iaik.asn1.CodingException:
	 No ASN.1 AlgorithmID type!
        	at iaik.pkcs.pkcs8.PrivateKeyInfo.a(Unknown Source)
        	at iaik.pkcs.pkcs8.PrivateKeyInfo.<init>(Unknown Source)
        	at Test.test(Test.java, Compiled Code)
        	at Test.main(Test.java:194)

For compatibility with our Weblogic instances, I have to load the private
key from a DER encoded file (so I can't use PKCS#12)

Any idea what I'm doing wrong?


David C. Harrison
+44 (0)20 7475 4393

Dresdner Kleinwort Wasserstein
20 Fenchurch Street
London EC3P 3DB
United Kingdom



----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------
--
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
 


----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------
--
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