anon.crypto
Class MyRSAPublicKey

java.lang.Object
  extended by anon.crypto.AbstractPublicKey
      extended by anon.crypto.MyRSAPublicKey
All Implemented Interfaces:
IMyPublicKey, IXMLEncodable, java.io.Serializable, java.security.Key, java.security.PublicKey

public final class MyRSAPublicKey
extends AbstractPublicKey
implements IMyPublicKey

See Also:
Serialized Form

Field Summary
private  MyRSASignature m_algorithm
           
private  java.math.BigInteger m_e
           
private  long m_hashValue
           
private  int m_keyLength
           
private  java.math.BigInteger m_n
           
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
MyRSAPublicKey(java.math.BigInteger modulus, java.math.BigInteger exponent)
           
MyRSAPublicKey(org.bouncycastle.crypto.CipherParameters cipherparams)
           
MyRSAPublicKey(org.bouncycastle.asn1.x509.RSAPublicKeyStructure en)
           
MyRSAPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo info)
           
 
Method Summary
 boolean equals(java.lang.Object a_publicKey)
          This method returns if two public keys have the same public key parameters.
 java.lang.String getAlgorithm()
           
 org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getAsSubjectPublicKeyInfo()
          Gets the key as a SubjectPublicKeyInfo object.
 java.lang.String getFormat()
           
static MyRSAPublicKey getInstance(byte[] encoded)
           
 int getKeyLength()
          Returns the length of the key.
 java.math.BigInteger getModulus()
           
 org.bouncycastle.crypto.CipherParameters getParams()
           
 java.math.BigInteger getPublicExponent()
           
 ISignatureVerificationAlgorithm getSignatureAlgorithm()
          Gets the signature algorithm object that is held and initialised by this key.
 int hashCode()
           
 java.lang.String toString()
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Builds an XML Node containing the public key data.
 
Methods inherited from class anon.crypto.AbstractPublicKey
getEncoded
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Key
getEncoded
 

Field Detail

m_algorithm

private MyRSASignature m_algorithm

m_n

private java.math.BigInteger m_n

m_e

private java.math.BigInteger m_e

m_hashValue

private long m_hashValue

m_keyLength

private int m_keyLength
Constructor Detail

MyRSAPublicKey

public MyRSAPublicKey(java.math.BigInteger modulus,
                      java.math.BigInteger exponent)

MyRSAPublicKey

public MyRSAPublicKey(org.bouncycastle.crypto.CipherParameters cipherparams)
               throws java.lang.Exception
Throws:
java.lang.Exception

MyRSAPublicKey

public MyRSAPublicKey(org.bouncycastle.asn1.x509.RSAPublicKeyStructure en)
               throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

MyRSAPublicKey

public MyRSAPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo info)
               throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

getInstance

public static MyRSAPublicKey getInstance(byte[] encoded)

getSignatureAlgorithm

public ISignatureVerificationAlgorithm getSignatureAlgorithm()
Gets the signature algorithm object that is held and initialised by this key. It is ready to verify messages and must not be reinitialised.

Specified by:
getSignatureAlgorithm in interface IMyPublicKey
Returns:
the signature algorithm object that is held and initialised by this key

getModulus

public java.math.BigInteger getModulus()

getPublicExponent

public java.math.BigInteger getPublicExponent()

getAlgorithm

public java.lang.String getAlgorithm()
Specified by:
getAlgorithm in interface java.security.Key

getFormat

public java.lang.String getFormat()
Specified by:
getFormat in interface java.security.Key

getKeyLength

public int getKeyLength()
Description copied from interface: IMyPublicKey
Returns the length of the key. The length of the key often corresponds with the security it provides.

Specified by:
getKeyLength in interface IMyPublicKey
Returns:
the length of the key

getAsSubjectPublicKeyInfo

public org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getAsSubjectPublicKeyInfo()
Description copied from interface: IMyPublicKey
Gets the key as a SubjectPublicKeyInfo object.

Specified by:
getAsSubjectPublicKeyInfo in interface IMyPublicKey
Returns:
the key as a SubjectPublicKeyInfo object

getParams

public org.bouncycastle.crypto.CipherParameters getParams()

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Builds an XML Node containing the public key data. This is compliant to the W3C XML Signature standard

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - the root document
Returns:
an XML Node

equals

public boolean equals(java.lang.Object a_publicKey)
This method returns if two public keys have the same public key parameters.

Specified by:
equals in interface IMyPublicKey
Specified by:
equals in class AbstractPublicKey
Parameters:
a_publicKey - an other public key
Returns:
true if the keys have the same public key parameters; false otherwise

hashCode

public int hashCode()
Specified by:
hashCode in interface IMyPublicKey
Specified by:
hashCode in class AbstractPublicKey
Returns:
the public key`s hash code
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object