anon.crypto
Class MyDSAPublicKey
java.lang.Object
anon.crypto.AbstractPublicKey
anon.crypto.MyDSAPublicKey
- All Implemented Interfaces:
- IMyPublicKey, IXMLEncodable, java.io.Serializable, java.security.interfaces.DSAKey, java.security.interfaces.DSAPublicKey, java.security.Key, java.security.PublicKey
public final class MyDSAPublicKey
- extends AbstractPublicKey
- implements java.security.interfaces.DSAPublicKey, IMyPublicKey
- See Also:
- Serialized Form
| Fields inherited from interface java.security.interfaces.DSAPublicKey |
serialVersionUID |
|
Constructor Summary |
MyDSAPublicKey(org.bouncycastle.crypto.params.DSAPublicKeyParameters params)
|
MyDSAPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo info)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.security.Key |
getEncoded |
m_Y
private java.math.BigInteger m_Y
m_params
private MyDSAParams m_params
m_hashValue
private long m_hashValue
MyDSAPublicKey
public MyDSAPublicKey(org.bouncycastle.crypto.params.DSAPublicKeyParameters params)
MyDSAPublicKey
public MyDSAPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo info)
throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
getSignatureAlgorithm
public ISignatureVerificationAlgorithm getSignatureAlgorithm()
- Gets a signature algorithm object for this key.
- Specified by:
getSignatureAlgorithm in interface IMyPublicKey
- Returns:
- a signature algorithm object for this key
getY
public java.math.BigInteger getY()
- Specified by:
getY in interface java.security.interfaces.DSAPublicKey
getParams
public java.security.interfaces.DSAParams getParams()
- Specified by:
getParams in interface java.security.interfaces.DSAKey
getPublicParams
public org.bouncycastle.crypto.params.DSAPublicKeyParameters getPublicParams()
getMyDASParams
public MyDSAParams getMyDASParams()
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
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
toXmlElement
public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
- Description copied from interface:
IXMLEncodable
- Return an element that can be appended to the document. This
Method must not change the document in any way!
- Specified by:
toXmlElement in interface IXMLEncodable
- Parameters:
a_doc - a document
- Returns:
- the interface as xml element
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()
getKeyLength
public int getKeyLength()
- Tested this implementation with Key-lengths from 256 to 1024 Bit in 64 Bit steps.
Always calculated the right size that was handed over to the KeyPairGenerator.
The actual size of the PublicKey is some bytes larger and the Parameters are
about twice as long as Y. But getKeyLength() is intended to give a hint about the
encryption strength, so this should be the best implementation.
- Specified by:
getKeyLength in interface IMyPublicKey
- Returns:
- the length of the key
getParameterLength
public int getParameterLength()