be.cardon.cryptoapi.provider
Class CryptoAPISignature

java.lang.Object
  extended by java.security.SignatureSpi
      extended by be.cardon.cryptoapi.provider.CryptoAPISignature
Direct Known Subclasses:
CryptoAPISignature.MD2, CryptoAPISignature.MD5, CryptoAPISignature.SHA1

public abstract class CryptoAPISignature
extends java.security.SignatureSpi

This class must be extended.


Nested Class Summary
static class CryptoAPISignature.MD2
           
static class CryptoAPISignature.MD5
           
static class CryptoAPISignature.SHA1
           
 
Field Summary
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
CryptoAPISignature()
          Creates a new instance of CryptoAPISignature
 
Method Summary
 java.lang.Object clone()
          Returns a clone if the implementation is cloneable.
protected  java.lang.Object engineGetParameter(java.lang.String param)
          Deprecated.
protected  java.security.AlgorithmParameters engineGetParameters()
          This method is overridden by providers to return the parameters used with this signature engine, or null if this signature engine does not use any parameters.
protected  void engineInitSign(java.security.PrivateKey privateKey)
          Initializes this signature object with the specified private key for signing operations.
protected  void engineInitSign(java.security.PrivateKey privateKey, java.security.SecureRandom random)
          Initializes this signature object with the specified private key (and source of randomness for signing operations => not used).
protected  void engineInitVerify(java.security.PublicKey publicKey)
          Initializes this signature object with the specified public key for verification operations.
protected  void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
          This method is overridden by providers to initialize this signature engine with the specified parameter set.
protected  void engineSetParameter(java.lang.String param, java.lang.Object value)
          Deprecated.
protected  byte[] engineSign()
          Returns the signature bytes of all the data updated so far.
protected  int engineSign(byte[] outbuf, int offset, int len)
          Finishes this signature operation and stores the resulting signature bytes in the provided buffer outbuf, starting at offset.
protected  void engineUpdate(byte b)
          Updates the data to be signed or verified using the specified byte.
protected  void engineUpdate(byte[] b, 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[] sigBytes)
          Verifies the passed-in signature.
protected  boolean engineVerify(byte[] sigBytes, int offset, int length)
          Verifies the passed-in signature in the specified array of bytes, starting at the specified offset.
protected  void setHashAlgorithm(java.lang.String hashAlg)
           
 
Methods inherited from class java.security.SignatureSpi
engineUpdate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CryptoAPISignature

public CryptoAPISignature()
Creates a new instance of CryptoAPISignature

Method Detail

setHashAlgorithm

protected void setHashAlgorithm(java.lang.String hashAlg)

clone

public java.lang.Object clone()
Returns a clone if the implementation is cloneable.

Overrides:
clone in class java.security.SignatureSpi

engineGetParameter

protected java.lang.Object engineGetParameter(java.lang.String param)
Deprecated.

Specified by:
engineGetParameter in class java.security.SignatureSpi

engineGetParameters

protected java.security.AlgorithmParameters engineGetParameters()
This method is overridden by providers to return the parameters used with this signature engine, or null if this signature engine does not use any parameters.

Overrides:
engineGetParameters in class java.security.SignatureSpi

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
Throws:
java.security.InvalidKeyException

engineInitSign

protected void engineInitSign(java.security.PrivateKey privateKey,
                              java.security.SecureRandom random)
                       throws java.security.InvalidKeyException
Initializes this signature object with the specified private key (and source of randomness for signing operations => not used).

Overrides:
engineInitSign in class java.security.SignatureSpi
Throws:
java.security.InvalidKeyException

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
Throws:
java.security.InvalidKeyException

engineSetParameter

protected void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
This method is overridden by providers to initialize this signature engine with the specified parameter set.

Overrides:
engineSetParameter in class java.security.SignatureSpi

engineSetParameter

protected void engineSetParameter(java.lang.String param,
                                  java.lang.Object value)
Deprecated. Replaced by engineSetParameter.

Specified by:
engineSetParameter in class java.security.SignatureSpi

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
Throws:
java.security.SignatureException

engineSign

protected int engineSign(byte[] outbuf,
                         int offset,
                         int len)
                  throws java.security.SignatureException
Finishes this signature operation and stores the resulting signature bytes in the provided buffer outbuf, starting at offset.

Overrides:
engineSign in class java.security.SignatureSpi
Throws:
java.security.SignatureException

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
Throws:
java.security.SignatureException

engineUpdate

protected void engineUpdate(byte[] b,
                            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
Throws:
java.security.SignatureException

engineVerify

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

Specified by:
engineVerify in class java.security.SignatureSpi
Throws:
java.security.SignatureException

engineVerify

protected boolean engineVerify(byte[] sigBytes,
                               int offset,
                               int length)
                        throws java.security.SignatureException
Verifies the passed-in signature in the specified array of bytes, starting at the specified offset.

Overrides:
engineVerify in class java.security.SignatureSpi
Throws:
java.security.SignatureException