anon.crypto
Class AbstractPublicKey

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

public abstract class AbstractPublicKey
extends java.lang.Object
implements IMyPublicKey

This class is an abstract implementation of a private key.

Author:
Rolf Wendolsky
See Also:
Serialized Form

Field Summary
 
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
protected AbstractPublicKey()
           
  AbstractPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo a_keyInfo)
          Creates a public key from a PrivateKeyInfo.
 
Method Summary
abstract  boolean equals(java.lang.Object a_publicKey)
          This method returns if two public keys have the same public key parameters.
 byte[] getEncoded()
          Returns the key in a byte encoded form that is defined to be the result of the method getAsSubjectPublicKeyInfo() .
abstract  int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface anon.crypto.IMyPublicKey
getAsSubjectPublicKeyInfo, getKeyLength, getSignatureAlgorithm
 
Methods inherited from interface java.security.Key
getAlgorithm, getFormat
 
Methods inherited from interface anon.util.IXMLEncodable
toXmlElement
 

Constructor Detail

AbstractPublicKey

protected AbstractPublicKey()

AbstractPublicKey

public AbstractPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo a_keyInfo)
Creates a public key from a PrivateKeyInfo. Every public key class should implement this constructor.

Parameters:
a_keyInfo - a SubjectPublicKeyInfo
Method Detail

getEncoded

public final byte[] getEncoded()
Returns the key in a byte encoded form that is defined to be the result of the method getAsSubjectPublicKeyInfo() .

Specified by:
getEncoded in interface java.security.Key
Returns:
the key in a byte encoded form
See Also:
IMyPublicKey.getAsSubjectPublicKeyInfo()

hashCode

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

equals

public abstract 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
Overrides:
equals in class java.lang.Object
Parameters:
a_publicKey - an other public key
Returns:
true if the keys have the same public key parameters; false otherwise