com.ibm.crypto.provider
Class SHA1withDSA

java.lang.Object
  extended by java.security.SignatureSpi
      extended by com.ibm.crypto.provider.SHA1withDSA

public class SHA1withDSA
extends SignatureSpi


Field Summary
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
SHA1withDSA()
          Constructs a new instance of this class.
 
Method Summary
protected  Object engineGetParameter(String param)
          Deprecated.  
protected  void engineInitSign(PrivateKey privateKey)
          Initialize the receiver with the specified private key, to be used for signing purposes.
protected  void engineInitVerify(PublicKey publicKey)
          Initialize the receiver with the specified public key, to be used for verification purposes.
protected  void engineSetParameter(String param, Object value)
          Deprecated. Replaced with engineSetParameter(AlgorithmParameterSpec)
protected  byte[] engineSign()
          Answers the signature bytes of the data updated so far.
protected  void engineUpdate(byte b)
          Update the bytes signed so far with the extra byte provided.
protected  void engineUpdate(byte[] buffer, int offset, int length)
          Update the bytes signed so far with the extra bytes provided.
protected  boolean engineVerify(byte[] sigBytes)
          Verifies the passed signature.
 String toString()
          Answers a string containing a concise, human-readable description of the receiver.
 
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, wait, wait, wait
 

Constructor Detail

SHA1withDSA

public SHA1withDSA()
            throws NoSuchAlgorithmException,
                   NoSuchProviderException
Constructs a new instance of this class.

Throws:
NoSuchAlgorithmException
NoSuchProviderException
Method Detail

engineGetParameter

protected Object engineGetParameter(String param)
                             throws InvalidParameterException
Deprecated. 

Answers the specified algorithm parameter. Since no parameters can be specified, it always throws an exception.

Specified by:
engineGetParameter in class SignatureSpi
Parameters:
param - String the parameter name.
Returns:
the specified algorithm parameter.
Throws:
InvalidParameterException - if the specified parameter name is invalid

engineInitSign

protected void engineInitSign(PrivateKey privateKey)
                       throws InvalidKeyException
Initialize the receiver with the specified private key, to be used for signing purposes.

Specified by:
engineInitSign in class SignatureSpi
Parameters:
privateKey - PrivateKey the key to be used when signing
Throws:
InvalidKeyException - if the specified key is not valid (improperly encoded, parameters missing, etc)

engineInitVerify

protected void engineInitVerify(PublicKey publicKey)
                         throws InvalidKeyException
Initialize the receiver with the specified public key, to be used for verification purposes.

Specified by:
engineInitVerify in class SignatureSpi
Parameters:
publicKey - PublicKey the key to be used when verifying
Throws:
InvalidKeyException - if the specified key is not valid (improperly encoded, parameters missing, etc)

engineSetParameter

protected void engineSetParameter(String param,
                                  Object value)
                           throws InvalidParameterException
Deprecated. Replaced with engineSetParameter(AlgorithmParameterSpec)

Initializes the receiver with the given parameter set.

Specified by:
engineSetParameter in class SignatureSpi
Parameters:
param - String the parameter name
value - Object the parameter value
Throws:
InvalidParameterException - if the specified parameter name is not valid for the receiver or if it has been set already

engineSign

protected byte[] engineSign()
                     throws SignatureException
Answers the signature bytes of the data updated so far.

Specified by:
engineSign in class SignatureSpi
Returns:
the signature bytes of the data updated so far.
Throws:
SignatureException - if the engine is not initialized properly

engineUpdate

protected void engineUpdate(byte b)
                     throws SignatureException
Update the bytes signed so far with the extra byte provided.

Specified by:
engineUpdate in class SignatureSpi
Parameters:
b - byte the extra byte to be signed.
Throws:
SignatureException - if the receiver is not initialized properly

engineUpdate

protected void engineUpdate(byte[] buffer,
                            int offset,
                            int length)
                     throws SignatureException
Update the bytes signed so far with the extra bytes provided.

Specified by:
engineUpdate in class SignatureSpi
Parameters:
buffer - byte[] the extra bytes to be signed.
offset - int offset in the buffer where to start getting bytes for signing
length - int how many bytes to get for signing
Throws:
SignatureException - if the receiver is not initialized properly

engineVerify

protected boolean engineVerify(byte[] sigBytes)
                        throws SignatureException
Verifies the passed signature.

Specified by:
engineVerify in class SignatureSpi
Parameters:
sigBytes - byte[] the signature bytes to verify
Returns:
true if the signature was verified successfully, false otherwise.
Throws:
SignatureException - if the receiver is not initialized properly or if the key is not encoded properly.

toString

public String toString()
Answers a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a printable representation for the receiver.