# Re: how to save and restore key pairs generated by keyPairGenerator?

Jan Luehe (Jan.Luehe@Eng)
Thu, 4 Jun 1998 09:49:25 -0700 (PDT)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: alexander.menkov@usa.net: "Help me please."
- Previous message: EVANS.CHRIS@canadatrust.com: "security classes...included with"
- Maybe in reply to: proger: "how to save and restore key pairs generated by keyPairGenerator?"

    Date: Thu, 4 Jun 1998 09:49:25 -0700 (PDT)

    From: Jan Luehe <Jan.Luehe@Eng>

    Subject: Re: how to save and restore key pairs generated by keyPairGenerator?

    To: java-security@web1.javasoft.com, tzdh@maina.jnu.edu.cn

> I want to save the keypairs generated by KeyPairGenerator to disk,and
> load them
> for siging and verfying in the future.
> The java.security.Key class have a method to return the encoded
> key,but it have
> not a method to generate a key from the encoded key.

In 1.1, you had to use (de)serialization to instantiate a Key
object from its serialized contents (note that java.security.Key
extends java.io.Serializable).

In 1.2, you instantiate a Key object from its encoding by using
a KeyFactory. See

http://java.sun.com/products/jdk/1.2/docs/guide/security/CryptoSpec.html#KeyFact
ory

for more details.

Jan

- Next message: alexander.menkov@usa.net: "Help me please."
- Previous message: EVANS.CHRIS@canadatrust.com: "security classes...included with"
- Maybe in reply to: proger: "how to save and restore key pairs generated by keyPairGenerator?"