public abstract class Signature
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected Key |
key |
protected int |
operation |
static int |
OPERATION_SIGN
Constant used to initialize this signature algorithm to sign.
|
static int |
OPERATION_VERIFY
Constant used to initialize this signature algorithm to verify.
|
| Constructor and Description |
|---|
Signature() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
doReset() |
protected abstract byte[] |
doSign(byte[] data) |
protected abstract boolean |
doVerify(byte[] data,
byte[] expected) |
abstract java.lang.String |
getAlgorithm()
Returns the name of the signature algorithm.
|
protected abstract boolean |
isKeySupported(Key key,
int operation) |
void |
reset(int operation,
Key key)
Initializes this message signature algorithm to sign or verify.
|
byte[] |
sign()
Finalizes the sign operation by processing all the accumulated input data and returning
the result in a new buffer.
|
java.lang.String |
toString()
Returns the name of the algorithm.
|
void |
update(byte[] data)
Updates the input data that will be processed by this signature algorithm.
|
void |
update(byte[] data,
int start,
int count)
Updates the input data that will be processed by this signature algorithm.
|
void |
update(int data)
Updates the input data that will be processed by this signature algorithm.
|
boolean |
verify(byte[] signature)
Finalizes the verify operation by processing all the accumulated input data and returning
the signature comparison result.
|
protected int operation
protected Key key
public static final int OPERATION_SIGN
public static final int OPERATION_VERIFY
public final java.lang.String toString()
toString in class java.lang.Objectpublic final void reset(int operation,
Key key)
throws CryptoException
operation - The operation mode of this signature algorithm (OPERATION_SIGN or OPERATION_VERIFY).key - The key.CryptoException - If one or more initialization parameters are invalid or the signature algorithm fails to initialize with the given
parameters.public final void update(int data)
sign() or verify(byte[]) is finally called.data - The input data.public final void update(byte[] data)
sign() or verify(byte[]) is finally called.data - The input data.public final void update(byte[] data,
int start,
int count)
sign() or verify(byte[]) is finally called.data - The input data.start - The offset in data where the data starts.count - The input length.public byte[] sign()
throws CryptoException
CryptoExceptionpublic boolean verify(byte[] signature)
throws CryptoException
CryptoExceptionpublic abstract java.lang.String getAlgorithm()
protected abstract boolean isKeySupported(Key key, int operation)
protected abstract void doReset()
throws NoSuchAlgorithmException,
CryptoException
protected abstract byte[] doSign(byte[] data)
throws CryptoException
CryptoExceptionprotected abstract boolean doVerify(byte[] data,
byte[] expected)
throws CryptoException
CryptoException