Class DatawithRSA


  • public final class DatawithRSA
    extends java.security.SignatureSpi
    This class is a concrete RSA signing with data implementation of the Service Provider Interface (SPI) for the Signature class, which is used to provide the functionality of a digital signature algorithm.

    This documentation is provided for implementation insight only. This class is not intended to be called directly by application developers. Please consult the 'Java Cryptography Architecture Standard' for details on how to use this interface through a public standard class.

    • Field Summary

      • Fields inherited from class java.security.SignatureSpi

        appRandom
    • Constructor Summary

      Constructors 
      Constructor Description
      DatawithRSA()
      Construct a blank RSA signature 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)
      Initializes this signature object with the specified private key for signing operations.
      protected void engineInitVerify​(java.security.PublicKey publicKey)
      Initializes this signature object with the specified public key for verification operations.
      protected void engineSetParameter​(java.lang.String key, java.lang.Object param)
      Deprecated. 
      protected byte[] engineSign()
      Returns the signature bytes of all the data updated so far.
      protected void engineUpdate​(byte b)
      Updates the data to be signed or verified using the specified byte.
      protected void engineUpdate​(byte[] buff, int off, int len)
      Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
      protected boolean engineVerify​(byte[] signature)
      Verifies the passed-in signature.
      • Methods inherited from class java.security.SignatureSpi

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

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

      • DatawithRSA

        public DatawithRSA()
                    throws java.security.NoSuchAlgorithmException,
                           java.security.NoSuchProviderException
        Construct a blank RSA signature object. This object must be initialized before being used for signing or verifying.
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
    • Method Detail

      • engineSetParameter

        @Deprecated
        protected void engineSetParameter​(java.lang.String key,
                                          java.lang.Object param)
                                   throws java.lang.UnsupportedOperationException
        Deprecated.
        Sets the specified algorithm parameter to the specified value. Please note that this method has no meaning for this provider and has been deprecated.
        Specified by:
        engineSetParameter in class java.security.SignatureSpi
        Parameters:
        key - the string identifier of the parameter
        param - the parameter value
        Throws:
        java.lang.UnsupportedOperationException - is always thrown.
      • engineGetParameter

        @Deprecated
        protected java.lang.Object engineGetParameter​(java.lang.String key)
                                               throws java.lang.UnsupportedOperationException
        Deprecated.
        Gets the value of the specified algorithm parameter. Please note that this method has no meaning for this provider, and has been deprecated.
        Specified by:
        engineGetParameter in class java.security.SignatureSpi
        Parameters:
        key - the string name of the parameter
        Throws:
        java.lang.UnsupportedOperationException - is always thrown.
      • engineInitSign

        protected void engineInitSign​(java.security.PrivateKey privateKey)
                               throws java.security.InvalidKeyException
        Initializes this signature object with the specified private key for signing operations.
        Specified by:
        engineInitSign in class java.security.SignatureSpi
        Parameters:
        privateKey - the private key of the identity whose signature will be generated
        Throws:
        java.security.InvalidKeyException - if the specified key is not a valid RSA private key (improperly encoded, parameters missing, etc).
      • engineInitVerify

        protected void engineInitVerify​(java.security.PublicKey publicKey)
                                 throws java.security.InvalidKeyException
        Initializes this signature object with the specified public key for verification operations.
        Specified by:
        engineInitVerify in class java.security.SignatureSpi
        Parameters:
        publicKey - the public key of the identity whose signature is going to be verified
        Throws:
        java.security.InvalidKeyException - if the specified key is not a valid RSA public key (improperly encoded, parameters missing, etc).
      • engineUpdate

        protected void engineUpdate​(byte b)
                             throws java.security.SignatureException
        Updates the data to be signed or verified using the specified byte.
        Specified by:
        engineUpdate in class java.security.SignatureSpi
        Parameters:
        b - the byte to use for the update
        Throws:
        java.security.SignatureException
      • engineUpdate

        protected void engineUpdate​(byte[] buff,
                                    int off,
                                    int len)
                             throws java.security.SignatureException
        Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
        Specified by:
        engineUpdate in class java.security.SignatureSpi
        Parameters:
        buff - the array of bytes
        off - the offset to start from in the array of bytes
        len - the number of bytes to use, starting at offset
        Throws:
        java.security.SignatureException
      • engineSign

        protected byte[] engineSign()
                             throws java.security.SignatureException
        Returns the signature bytes of all the data updated so far.
        Specified by:
        engineSign in class java.security.SignatureSpi
        Returns:
        the signature bytes of the signing operation's result.
        Throws:
        java.security.SignatureException - if the engine is not initialized properly or if this signature algorithm is unable to process the input data provided.
      • engineVerify

        protected boolean engineVerify​(byte[] signature)
                                throws java.security.SignatureException
        Verifies the passed-in signature.
        Specified by:
        engineVerify in class java.security.SignatureSpi
        Parameters:
        signature - the signature bytes to be verified
        Returns:
        true if the signature was verified, false if not.
        Throws:
        java.security.SignatureException - if the engine is not initialized properly, the passed-in signature is improperly encoded or of the wrong type, if this signature algorithm is unable to process the input data provided, etc.