Class DSA


  • public final class DSA
    extends java.security.Signature
    The Digital Signature Standard (using the Digital Signature Algorithm), as described in fips186 of the National Instute of Standards and Technology (NIST), using fips180-1 (SHA-1).
    Version:
    1.86, 97/09/17
    Author:
    Benjamin Renaud
    See Also:
    DSAPublicKey, DSAPrivateKey
    • Field Summary

      • Fields inherited from class java.security.Signature

        SIGN, state, UNINITIALIZED, VERIFY
      • Fields inherited from class java.security.SignatureSpi

        appRandom
    • Constructor Summary

      Constructors 
      Constructor Description
      DSA()
      Construct a blank DSA object.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected java.lang.Object engineGetParameter​(java.lang.String key)
      Deprecated. 
      protected void engineInitSign​(java.security.PrivateKey privateKey)
      Initialize the DSA object with a DSA private key.
      protected void engineInitVerify​(java.security.PublicKey publicKey)
      Initialize the DSA object with a DSA public key.
      protected void engineSetParameter​(java.lang.String key, java.lang.Object param)
      Deprecated. 
      protected byte[] engineSign()
      Sign all the data thus far updated.
      protected void engineUpdate​(byte b)
      Update a byte to be signed or verified.
      protected void engineUpdate​(byte[] data, int off, int len)
      Update an array of bytes to be signed or verified.
      protected boolean engineVerify​(byte[] signature)
      Verify all the data thus far updated.
      java.lang.String toString()
      Return a human readable rendition of the engine.
      • Methods inherited from class java.security.Signature

        clone, getAlgorithm, getInstance, getInstance, getInstance, getParameter, getParameters, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, update, update, update, update, verify, verify
      • Methods inherited from class java.security.SignatureSpi

        engineGetParameters, engineInitSign, engineSetParameter, engineSign, engineUpdate, engineVerify
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DSA

        public DSA()
            throws java.security.NoSuchAlgorithmException
        Construct a blank DSA object. It can generate keys, but must be initialized before being usable for signing or verifying.
        Throws:
        java.security.NoSuchAlgorithmException
    • Method Detail

      • engineInitSign

        protected void engineInitSign​(java.security.PrivateKey privateKey)
                               throws java.security.InvalidKeyException
        Initialize the DSA object with a DSA private key.
        Specified by:
        engineInitSign in class java.security.SignatureSpi
        Parameters:
        privateKey - the DSA private key
        Throws:
        java.security.InvalidKeyException - if the key is not a valid DSA private key.
      • engineInitVerify

        protected void engineInitVerify​(java.security.PublicKey publicKey)
                                 throws java.security.InvalidKeyException
        Initialize the DSA object with a DSA public key.
        Specified by:
        engineInitVerify in class java.security.SignatureSpi
        Parameters:
        publicKey - the DSA public key.
        Throws:
        java.security.InvalidKeyException - if the key is not a valid DSA public key.
      • engineSign

        protected byte[] engineSign()
                             throws java.security.SignatureException
        Sign all the data thus far updated. The signature is formatted according to the Canonical Encoding Rules, returned as a DER sequence of Integer, r and s.
        Specified by:
        engineSign in class java.security.SignatureSpi
        Returns:
        a signature block formatted according to the Canonical Encoding Rules.
        Throws:
        java.security.SignatureException - if the signature object was not properly initialized, or if another exception occurs.
        See Also:
        engineUpdate(byte), engineVerify(byte[])
      • engineVerify

        protected boolean engineVerify​(byte[] signature)
                                throws java.security.SignatureException
        Verify all the data thus far updated.
        Specified by:
        engineVerify in class java.security.SignatureSpi
        Parameters:
        signature - the alledged signature, encoded using the Canonical Encoding Rules, as a sequence of integers, r and s.
        Throws:
        java.security.SignatureException - if the signature object was not properly initialized, or if another exception occurs.
        See Also:
        engineUpdate(byte), engineSign()
      • engineSetParameter

        protected void engineSetParameter​(java.lang.String key,
                                          java.lang.Object param)
        Deprecated.
        This implementation recognizes the following parameter:
        Kseed
        a byte array.
        Specified by:
        engineSetParameter in class java.security.SignatureSpi
      • engineGetParameter

        protected java.lang.Object engineGetParameter​(java.lang.String key)
        Deprecated.
        Return the value of the requested parameter. Recognized parameters are:
        Kseed
        a byte array.
        Specified by:
        engineGetParameter in class java.security.SignatureSpi
        Returns:
        the value of the requested parameter.
      • engineUpdate

        protected void engineUpdate​(byte b)
        Update a byte to be signed or verified.
        Specified by:
        engineUpdate in class java.security.SignatureSpi
        Parameters:
        b - the byte to updated.
      • engineUpdate

        protected void engineUpdate​(byte[] data,
                                    int off,
                                    int len)
        Update an array of bytes to be signed or verified.
        Specified by:
        engineUpdate in class java.security.SignatureSpi
        Parameters:
        data - the bytes to be updated.
      • toString

        public java.lang.String toString()
        Return a human readable rendition of the engine.
        Overrides:
        toString in class java.security.Signature