|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Interface to be implemented for supporting RSA public keys.
Attention: This is not a SUN implementation!
This class has been developed by IAIK according to the documentation publically available.
For SUNīs documentation of this class see
http://java.sun.com/security/JCE1.2/earlyaccess/javax.crypto.interfaces.RSAPublicKey.html
PKCS#1 describes a X.509/PEM
compatible syntax for RSA public keys to be used in certificates. The corresponding ASN.1
type RSAPublicKey is defined as ASN.1 SEQUENCE:
RSAPublicKey ::= SEQUENCE {
modulus INTEGER, -- n
publicExponent INTEGER -- e }
An application wishing to create a RSAPublicKey to be used for, e.g. data encryption or
signature verifying with the RSA algorithm, uses a proper getInstance method of the
java.security.KeyPairGenerator class, which subsequently maybe casted to
RSAKeyPairGenerator for performing an algorithm-specific initialization with
proper RSA parameters. If an algorithm-specific initialization is not required, the cast
to RSAKeyPairGenerator can be omitted.
Generally four steps have to be performed for creating a RSAPublicKey by using a proper KeyPairGenerator:
KeyPairGenerator has to be instantiated thereby specifying
the applicationīs intention to create keys for use within the RSA algorithm:
KeyPairGenerator key_gen = KeyPairGenerator.getInstance("RSA");
initialize method. For initializing the generator to create keys with
a modulus length of, e.g., 512 bits, this can be explicitly specified (when not
initializing the generator explicitly, per default the modulus length is set to
1024 bits):
key_gen.initialize(512);
generateKeyPair():
KeyPair key_pair = key_gen.generateKeyPair();
RSAPublicKey rsa_pub_key = (RSAPublicKey)key_pair.getPublic();
For performing an algorithm-specific initialization with particular RSA parameters (e.g. using a particular public exponent e), an explicit cast of the KeyPairGenerator will be necessary for obtaining a specific RSAKeyPairGenerator to be initialized with the desired RSA parameters:
(whereRSAKeyPairGenerator rsa_key_gen = (RSAKeyPairGenerator)key_gen; rsa_key_gen.initialize(512, pub_exponent, sec_random);
sec_random denotes some random seed)
Guidelines on how to create some key using a KeyPairGenerator can be found in http://java.sun.com/products/JDK/1.1/docs/guide/security/CryptoSpec.html.
| Fields inherited from interface java.security.PublicKey |
serialVersionUID |
| Fields inherited from interface java.security.Key |
serialVersionUID |
| Method Summary | |
java.math.BigInteger |
getModulus()
Returns the modulus n. |
java.math.BigInteger |
getPublicExponent()
Returns the public exponent e. |
| Methods inherited from interface java.security.Key |
getAlgorithm,
getEncoded,
getFormat |
| Method Detail |
public java.math.BigInteger getModulus()
n.public java.math.BigInteger getPublicExponent()
e.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||