anon.crypto
Class MyRSAPublicKey
java.lang.Object
anon.crypto.AbstractPublicKey
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
Fields inherited from interface java.security.PublicKey |
serialVersionUID |
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)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.security.Key |
getEncoded |
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
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
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