Class DSAPublicKey

  • All Implemented Interfaces:
    java.io.Serializable, java.security.interfaces.DSAKey, java.security.interfaces.DSAPublicKey, java.security.Key, java.security.PublicKey

    public final class DSAPublicKey
    extends X509Key
    implements java.security.interfaces.DSAPublicKey
    An X.509 public key for the Digital Signature Algorithm.
    See Also:
    DSAPrivateKey, AlgIdDSA, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DSAPublicKey()  
      DSAPublicKey​(byte[] encoded)
      Make a DSA public key from its DER encoding (X.509).
      DSAPublicKey​(java.math.BigInteger y, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)
      Make a DSA public key out of a public key and three parameters.
    • Constructor Detail

      • DSAPublicKey

        public DSAPublicKey()
      • DSAPublicKey

        public DSAPublicKey​(java.math.BigInteger y,
                            java.math.BigInteger p,
                            java.math.BigInteger q,
                            java.math.BigInteger g)
                     throws java.security.InvalidKeyException
        Make a DSA public key out of a public key and three parameters.
        Throws:
        java.security.InvalidKeyException
      • DSAPublicKey

        public DSAPublicKey​(byte[] encoded)
                     throws java.security.InvalidKeyException
        Make a DSA public key from its DER encoding (X.509).
        Throws:
        java.security.InvalidKeyException
    • Method Detail

      • getParams

        public java.security.interfaces.DSAParams getParams()
        Returns the DSA parameters associated with this key, or null if the parameters could not be parsed.
        Specified by:
        getParams in interface java.security.interfaces.DSAKey
      • getY

        public java.math.BigInteger getY()
        Get the raw public value, y, without the parameters.
        Specified by:
        getY in interface java.security.interfaces.DSAPublicKey
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class X509Key
      • parseKeyBits

        protected void parseKeyBits()
                             throws java.security.InvalidKeyException
        Description copied from class: X509Key
        Parse the key bits. This may be redefined by subclasses to take advantage of structure within the key. For example, RSA public keys encapsulate two unsigned integers (modulus and exponent) as DER values within the key bits; Diffie-Hellman and DSS/DSA keys encapsulate a single unsigned integer.

        This function is called when creating X.509 SubjectPublicKeyInfo values using the X509Key member functions, such as parse and decode.

        Overrides:
        parseKeyBits in class X509Key
        Throws:
        java.security.InvalidKeyException - on invalid key encodings.
      • hashCode

        public int hashCode()
        Description copied from class: X509Key
        Calculates a hash code value for the object. Objects which are equal will also have the same hashcode.
        Overrides:
        hashCode in class X509Key
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class X509Key