de.flexiprovider.core.rsa
Class RSAPublicKey

java.lang.Object
  |
  +--de.flexiprovider.api.keys.PublicKey
        |
        +--de.flexiprovider.core.rsa.interfaces.RSAPublicKey
              |
              +--de.flexiprovider.core.rsa.RSAPublicKey
All Implemented Interfaces:
Key, java.security.Key, java.security.PublicKey, RSAKey, java.security.interfaces.RSAKey, java.security.interfaces.RSAPublicKey, java.io.Serializable

public final class RSAPublicKey
extends RSAPublicKey

This class implements the RSAPublicKey interface. It represents a RSA public key and is usually instantiated from RSAKeyPairGenerator.

Author:
Thomas Wahrenbruch, Ralf-Philipp Weinmann
See Also:
RSAKeyPairGenerator, Serialized Form

Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
RSAPublicKey(FlexiBigInt n, FlexiBigInt e)
          Generates a new RSA public key.
RSAPublicKey(RSAPublicKeySpec keySpec)
          Construct an RSAPubKey out of the given key specification.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compare this key with another object.
protected  codec.asn1.ASN1Type getAlgParams()
           
 FlexiBigInt getE()
           
protected  byte[] getKeyData()
           
 FlexiBigInt getN()
           
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class de.flexiprovider.core.rsa.interfaces.RSAPublicKey
getAlgorithm, getModulus, getPublicExponent
 
Methods inherited from class de.flexiprovider.api.keys.PublicKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Key
getEncoded, getFormat
 

Constructor Detail

RSAPublicKey

public RSAPublicKey(FlexiBigInt n,
                    FlexiBigInt e)
Generates a new RSA public key.
Parameters:
n - the modulus n = p*q;
e - the public exponent e.
See Also:
RSAKeyPairGenerator

RSAPublicKey

public RSAPublicKey(RSAPublicKeySpec keySpec)
Construct an RSAPubKey out of the given key specification.
Parameters:
keySpec - the key specification
Method Detail

getN

public FlexiBigInt getN()
Returns:
the modulus n

getE

public FlexiBigInt getE()
Overrides:
getE in class RSAPublicKey
Returns:
the public exponent e

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a human readable form of the key

equals

public boolean equals(java.lang.Object other)
Compare this key with another object.
Overrides:
equals in class java.lang.Object
Parameters:
other - the other object
Returns:
the result of the comparison

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getOID

protected codec.asn1.ASN1ObjectIdentifier getOID()
Overrides:
getOID in class PublicKey
Returns:
the OID to encode in the SubjectPublicKeyInfo structure

getAlgParams

protected codec.asn1.ASN1Type getAlgParams()
Overrides:
getAlgParams in class PublicKey
Returns:
the algorithm parameters to encode in the SubjectPublicKeyInfo structure

getKeyData

protected byte[] getKeyData()
Overrides:
getKeyData in class PublicKey
Returns:
the keyData to encode in the SubjectPublicKeyInfo structure