Re: Initializing DSA keys

Jan Luehe (luehe@laguna.eng.sun.com)
Mon, 24 May 1999 09:39:35 -0700 (PDT)

Message-Id: <199905241639.JAA11788@laguna.eng.sun.com>
Date: Mon, 24 May 1999 09:39:35 -0700 (PDT)
From: Jan Luehe <luehe@laguna.eng.sun.com>
Subject: Re: Initializing DSA keys
To: java-security@java.sun.com, ekr@rtfm.com

Eric:

We provide so-called "key factories" for what you are trying
to do.

You need to instantiate a KeyFactory for "DSA" and pass it a
key specification of your encoded key(s).

In the case of your public key, you need to construct a
java.security.spec.X509EncodedKeySpec from the byte
encoding of your public key.

In the case of your private key, you need to construct
a java.security.spec.PKCS8EncodedKeySpec from the byte
encoding of your private key.

See

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

for more information.

Jan

> To: java-security@java.sun.com
> Subject: Initializing DSA keys
> Mime-Version: 1.0 (generated by tm-edit 7.108)
> Date: Sat, 22 May 1999 17:27:26 -0700
> From: Eric Rescorla <ekr@rtfm.com>
>
> It's perfectly clear from the documentation how to generate
> DSA keys, but that's not what people typically want to do.
>
> What they want to do is to turn encoded public and private
> keys (typically in PKCS1 or X.509 SubjectPublicKeyInfo)
> form into usable keys in the application. Despite quite
> a bit of grovelling through documentation, I can't figure
> out how to do this with the provided JCA DSA implementation.
>
> I don't insist at all that the interface allow me to use
> encoded keys, I'm quite happy to break the keys up into
> BigIntegers or whatever, but I can't figure out how to
> insert externally generated keys _at all_. Surely this
> must be possible. A pointer to appropriate documentation
> would be very much appreciated.
>
> Thanks,
> -Ekr
> [Eric Rescorla ekr@rtfm.com]
>