public abstract class AbstractSignature extends java.lang.Object implements Signature
Signature that implements common functionality.| Modifier and Type | Field and Description |
|---|---|
protected java.security.Signature |
signature |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSignature(java.security.Signature signatureEngine) |
protected |
AbstractSignature(java.lang.String algorithm) |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
extractSig(byte[] sig,
java.lang.String expectedKeyAlgorithm)
Check whether the signature is generated using the expected algorithm, and if so, return the signature blob
|
void |
initSign(java.security.PrivateKey privateKey)
Initialize this signature with the given private key for signing.
|
void |
initVerify(java.security.PublicKey publicKey)
Initialize this signature with the given public key for signature verification.
|
byte[] |
sign()
Compute the signature.
|
void |
update(byte[] foo)
Convenience method, same as calling
Signature.update(byte[], int, int) with offset as 0 and H.length. |
void |
update(byte[] foo,
int off,
int len)
Update the computed signature with the given data.
|
protected AbstractSignature(java.lang.String algorithm)
protected AbstractSignature(java.security.Signature signatureEngine)
public void initVerify(java.security.PublicKey publicKey)
SignatureSignature.initVerify(PublicKey) or Signature.initSign(PrivateKey) will
overwrite prior initialization.initVerify in interface SignaturepublicKey - the public key to use for signature verificationpublic void initSign(java.security.PrivateKey privateKey)
SignatureSignature.initVerify(PublicKey) or Signature.initSign(PrivateKey) will
overwrite prior initialization.public void update(byte[] foo)
SignatureSignature.update(byte[], int, int) with offset as 0 and H.length.public void update(byte[] foo,
int off,
int len)
Signaturepublic byte[] sign()
Signatureprotected byte[] extractSig(byte[] sig,
java.lang.String expectedKeyAlgorithm)
sig - The full signatureexpectedKeyAlgorithm - The expected key algorithm