Date: Mon, 27 Apr 1998 17:25:09 -0700 (PDT)
From: Jan Luehe <Jan.Luehe@Eng>
Subject: Re: Instantiating PrivateKey ..
To: java-security@web1.javasoft.com, spandran@xeti.com
Srinivas:
> I am new to Java Security and would appreciate any help I can get.
> I have a DER encoded private key stored in a file. I need to instantiate
> a PrivateKey object from this data. The API doesn't(?) show a way to do
> this. I can do this now using an undocumented class (sun.security...)
> but the product I am working on, has to pass the pure java test, which
> means I cannot use any undocumented classes. Is there a workaround for
> this ?
The java.security.KeyFactory class in JDK 1.2 does exactly
what you are trying to do.
Please check
http://java.sun.com/products/jdk/1.2/docs/guide/security/CryptoSpec.html#KeyFact
oryEx
for examples on how to create a Key object from the key's encoding.
Thanks,
Jan