de.flexiprovider.api
Class Signature

java.lang.Object
  |
  +--java.security.SignatureSpi
        |
        +--de.flexiprovider.api.Signature
Direct Known Subclasses:
CMSSSignature, DSASignature, ECDSASignature, ECNRSignature, GMSSSignature, IQDSASignature, IQGQSignature, IQRDSASignature, LMOTSSignature, MerkleOTSSignature, MeRSASignaturePSS, MpRSASignaturePSS, NiederreiterCFSSignature, PFlashSignature, RainbowSignature, RSASignaturePKCS1v15, RSASignaturePSS, SSLSignature, TSS

public abstract class Signature
extends java.security.SignatureSpi

This class defines the Service Provider Interface (SPI) for the Signature class, which is used to provide the functionality of a digital signature algorithm. Digital signatures are used for authentication and integrity assurance of digital data. .

All the abstract methods in this class must be implemented by each cryptographic service provider who wishes to supply the implementation of a particular signature algorithm.

Author:
Martin Döring, Johannes Müller

Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
Signature()
           
 
Method Summary
protected  java.lang.Object engineGetParameter(java.lang.String param)
          Deprecated.  
protected  void engineInitSign(java.security.PrivateKey privateKey)
           
protected  void engineInitSign(java.security.PrivateKey privateKey, java.security.SecureRandom javaRand)
           
protected  void engineInitVerify(java.security.PublicKey publicKey)
           
protected  void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
           
protected  void engineSetParameter(java.lang.String param, java.lang.Object value)
          Deprecated.  
protected  byte[] engineSign()
           
protected  void engineUpdate(byte b)
           
protected  void engineUpdate(byte[] b, int off, int len)
           
protected  boolean engineVerify(byte[] sigBytes)
           
protected  boolean engineVerify(byte[] sigBytes, int offset, int length)
           
 void initSign(PrivateKey privKey)
          Initialize the signature with the specified private key for signing operations.
abstract  void initSign(PrivateKey privKey, SecureRandom random)
          Initialize the signature with the specified private key and source of randomness for signing operations.
abstract  void initVerify(PublicKey pubKey)
          Initialize the signature with the specified public key for verification operations.
abstract  void setParameters(AlgorithmParameterSpec params)
          Initialize the signature with the specified parameters.
abstract  byte[] sign()
          Return the signature of all the data updated so far.
 byte[] sign(byte[] input)
          Update the data to be signed and return the signature of all the data updated so far.
abstract  void update(byte input)
          Update the data to be signed or verified using the specified byte.
 void update(byte[] input)
          Update the data to be signed or verified using the specified byte array.
abstract  void update(byte[] input, int inOff, int inLen)
          Update the data to be signed or verified, using the specified byte array of the specified length, starting at the specified offset.
abstract  boolean verify(byte[] signature)
          Verify the passed-in signature of the specified message.
 boolean verify(byte[] input, byte[] signature)
          Update the data to be verified and verify the passed-in signature.
 boolean verify(byte[] input, byte[] signature, int sigOff, int sigLen)
          Update the data to be verified and verify the passed-in signature.
 boolean verify(byte[] signature, int sigOff, int sigLen)
          Verify the passed-in signature.
 
Methods inherited from class java.security.SignatureSpi
clone, engineSign
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Signature

public Signature()
Method Detail

engineGetParameter

protected final java.lang.Object engineGetParameter(java.lang.String param)
                                             throws java.security.InvalidParameterException
Deprecated.  

Overrides:
engineGetParameter in class java.security.SignatureSpi

engineSetParameter

protected final void engineSetParameter(java.lang.String param,
                                        java.lang.Object value)
                                 throws java.security.InvalidParameterException
Deprecated.  

Overrides:
engineSetParameter in class java.security.SignatureSpi

engineInitSign

protected final void engineInitSign(java.security.PrivateKey privateKey)
                             throws java.security.InvalidKeyException
Overrides:
engineInitSign in class java.security.SignatureSpi

engineInitSign

protected final void engineInitSign(java.security.PrivateKey privateKey,
                                    java.security.SecureRandom javaRand)
                             throws java.security.InvalidKeyException
Overrides:
engineInitSign in class java.security.SignatureSpi

engineInitVerify

protected final void engineInitVerify(java.security.PublicKey publicKey)
                               throws java.security.InvalidKeyException
Overrides:
engineInitVerify in class java.security.SignatureSpi

engineSetParameter

protected void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
                           throws java.security.InvalidAlgorithmParameterException
Overrides:
engineSetParameter in class java.security.SignatureSpi

engineUpdate

protected final void engineUpdate(byte b)
                           throws java.security.SignatureException
Overrides:
engineUpdate in class java.security.SignatureSpi

engineUpdate

protected final void engineUpdate(byte[] b,
                                  int off,
                                  int len)
                           throws java.security.SignatureException
Overrides:
engineUpdate in class java.security.SignatureSpi

engineSign

protected final byte[] engineSign()
                           throws java.security.SignatureException
Overrides:
engineSign in class java.security.SignatureSpi

engineVerify

protected final boolean engineVerify(byte[] sigBytes)
                              throws java.security.SignatureException
Overrides:
engineVerify in class java.security.SignatureSpi

engineVerify

protected final boolean engineVerify(byte[] sigBytes,
                                     int offset,
                                     int length)
                              throws java.security.SignatureException

initSign

public final void initSign(PrivateKey privKey)
                    throws InvalidKeyException
Initialize the signature with the specified private key for signing operations.
Parameters:
privKey - the private key of the identity whose signature will be generated.
Throws:
InvalidKeyException - if the key is invalid for initializing the signature.

initSign

public abstract void initSign(PrivateKey privKey,
                              SecureRandom random)
                       throws InvalidKeyException
Initialize the signature with the specified private key and source of randomness for signing operations.
Parameters:
privKey - the private key of the identity whose signature will be generated.
random - the source of randomness
Throws:
InvalidKeyException - if the key is invalid for initializing the signature.

initVerify

public abstract void initVerify(PublicKey pubKey)
                         throws InvalidKeyException
Initialize the signature with the specified public key for verification operations.
Parameters:
pubKey - the public key of the identity whose signature is going to be verified
Throws:
InvalidKeyException - if the key is invalid for initializing the signature.

setParameters

public abstract void setParameters(AlgorithmParameterSpec params)
                            throws InvalidAlgorithmParameterException
Initialize the signature with the specified parameters.
Parameters:
params - the parameters
Throws:
InvalidAlgorithmParameterException - if the given parameters are inappropriate for this signature.

update

public abstract void update(byte input)
                     throws SignatureException
Update the data to be signed or verified using the specified byte.
Parameters:
input - the data byte
Throws:
SignatureException - if the engine is not initialized properly.

update

public final void update(byte[] input)
                  throws SignatureException
Update the data to be signed or verified using the specified byte array.
Parameters:
input - the data byte array
Throws:
SignatureException - if the engine is not initialized properly.

update

public abstract void update(byte[] input,
                            int inOff,
                            int inLen)
                     throws SignatureException
Update the data to be signed or verified, using the specified byte array of the specified length, starting at the specified offset.
Parameters:
input - the data byte array
inOff - the offset to start from in the array of bytes
inLen - the number of bytes to use, starting at inOff
Throws:
SignatureException - if the engine is not initialized properly

sign

public abstract byte[] sign()
                     throws SignatureException
Return the signature of all the data updated so far.
Returns:
the signature
Throws:
SignatureException - if the engine is not initialized properly.

sign

public final byte[] sign(byte[] input)
                  throws SignatureException
Update the data to be signed and return the signature of all the data updated so far.
Parameters:
input - the data byte array
Returns:
the signature
Throws:
SignatureException - if the engine is not initialized properly.

verify

public abstract boolean verify(byte[] signature)
                        throws SignatureException
Verify the passed-in signature of the specified message.
Parameters:
signature - the signature
Returns:
true if the signature is valid, false otherwise.
Throws:
SignatureException - if the engine is not initialized properly or the passed-in signature is improperly encoded or of the wrong type.

verify

public final boolean verify(byte[] input,
                            byte[] signature)
                     throws SignatureException
Update the data to be verified and verify the passed-in signature.
Parameters:
input - the data byte array
signature - the signature
Returns:
true if the signature is valid, false otherwise.
Throws:
SignatureException - if the engine is not initialized properly or the passed-in signature is improperly encoded or of the wrong type.

verify

public final boolean verify(byte[] signature,
                            int sigOff,
                            int sigLen)
                     throws SignatureException
Verify the passed-in signature.
Parameters:
signature - the signature
sigOff - the offset where the signature starts
sigLen - the length of the signature
Returns:
true if the signature is valid, false otherwise.
Throws:
SignatureException - if the engine is not initialized properly or the passed-in signature is improperly encoded or of the wrong type.

verify

public final boolean verify(byte[] input,
                            byte[] signature,
                            int sigOff,
                            int sigLen)
                     throws SignatureException
Update the data to be verified and verify the passed-in signature.
Parameters:
input - the data byte array
signature - the signature
sigOff - the offset where the signature starts
sigLen - the length of the signature
Returns:
true if the signature is valid, false otherwise.
Throws:
SignatureException - if the engine is not initialized properly or the passed-in signature is improperly encoded or of the wrong type.