Date: Wed, 27 May 1998 10:54:35 -0700 (PDT)
From: Jan Luehe <Jan.Luehe@Eng>
Subject: Re: Your Message Sent on Wed, 27 May 1998 12:53:40 +0200
To: java-security@web2.javasoft.com, mvila@dgtic.caib.es
Marc:
> How can I obtain the public modulus and the exponents of the private and
> the public keys?
> (for example, for the RSA algorithm)
>
> I generate a KeyPairGenerator,initialize it and generate the pair of
keys
> (generateKeyPair(), and the getPublic() and getPrivate()). But I don't know
> how can i obtain the exponent and the modulus of each key.
The RSA public key returned by getPublic() should implement the
RSAPublicKey interface (currently in javax.crypto.interfaces.RSAPublicKey
in JCE 1.2), which provides access to the key components you need.
The RSA private key returned by getPrivate() should implement the
RSAPrivateKey (or RSAPrivateCrtKey) interface in the same JCE 1.2 package.
It is the responsibility of the provider of the RSA KeyPairGenerator that
the returned keys implement those interfaces.
Note that the above interfaces will be part of JDK 1.2 and will be
removed from JCE 1.2.
Jan