java.security.interfaces
Interface RSAPublicKey

All Known Implementing Classes:
RSAPublicKey

public interface RSAPublicKey
extends PublicKey

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:

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:

 RSAKeyPairGenerator rsa_key_gen = (RSAKeyPairGenerator)key_gen;
 rsa_key_gen.initialize(512, pub_exponent, sec_random);
 
(where 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

getModulus

public java.math.BigInteger getModulus()
Returns the modulus n.
Returns:
the modulus

getPublicExponent

public java.math.BigInteger getPublicExponent()
Returns the public exponent e.