| java.lang.Object java.security.SignatureSpi
All known Subclasses: com.sun.j2me.crypto.MD5RSASignature, com.sun.j2me.crypto.SHA1RSASignature,
SignatureSpi | abstract public class SignatureSpi (Code) | | 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: Benjamin Renaud version: 1.15, 05/03/00 See Also: Signature |
Method Summary | |
public Object | clone() Returns a clone if the implementation is cloneable. | protected 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. | abstract protected void | engineInitSign(PrivateKey privateKey) Initializes this signature object with the specified
private key for signing operations.
Parameters: privateKey - the private key of the identity whose signaturewill be generated. exception: InvalidKeyException - if the key is improperlyencoded, parameters are missing, and so on. | protected void | engineInitSign(PrivateKey privateKey, SecureRandom random) Initializes this signature object with the specified
private key and source of randomness for signing operations.
This concrete method has been added to this previously-defined
abstract class. | abstract protected void | engineInitVerify(PublicKey publicKey) Initializes this signature object with the specified
public key for verification operations.
Parameters: publicKey - the public key of the identity whose signature isgoing to be verified. exception: InvalidKeyException - if the key is improperlyencoded, parameters are missing, and so on. | protected void | engineSetParameter(AlgorithmParameterSpec params) This method is overridden by providers to initialize
this signature engine with the specified parameter set. | abstract 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 .
The format of the signature depends on the underlying
signature scheme.
The signature implementation is reset to its initial state
(the state it was in after a call to one of the
engineInitSign methods)
and can be reused to generate further signatures with the same private
key.
This method should be abstract, but we leave it concrete for
binary compatibility. | abstract protected void | engineUpdate(byte b) Updates the data to be signed or verified
using the specified byte. | abstract 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. | abstract 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.
Note: Subclasses should overwrite the default implementation.
Parameters: sigBytes - the signature bytes to be verified. Parameters: offset - the offset to start from in the array of bytes. Parameters: length - the number of bytes to use, starting at offset. |
appRandom | protected SecureRandom appRandom(Code) | | Application-specified source of randomness.
|
engineGetParameters | protected AlgorithmParameters engineGetParameters()(Code) | | 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.
The returned parameters may be the same that were used to initialize
this signature engine, or may contain a combination of default and
randomly generated parameter values used by the underlying signature
implementation if this signature engine requires algorithm parameters
but was not initialized with any.
the parameters used with this signature engine, or null if thissignature engine does not use any parameters exception: UnsupportedOperationException - if this method isnot overridden by a provider |
engineInitSign | abstract protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException(Code) | | Initializes this signature object with the specified
private key for signing operations.
Parameters: privateKey - the private key of the identity whose signaturewill be generated. exception: InvalidKeyException - if the key is improperlyencoded, parameters are missing, and so on. |
engineInitSign | protected void engineInitSign(PrivateKey privateKey, SecureRandom random) throws InvalidKeyException(Code) | | Initializes this signature object with the specified
private key and source of randomness for signing operations.
This concrete method has been added to this previously-defined
abstract class. (For backwards compatibility, it cannot be abstract.)
Parameters: privateKey - the private key of the identity whose signaturewill be generated. Parameters: random - the source of randomness exception: InvalidKeyException - if the key is improperlyencoded, parameters are missing, and so on. |
engineInitVerify | abstract protected void engineInitVerify(PublicKey publicKey) throws InvalidKeyException(Code) | | Initializes this signature object with the specified
public key for verification operations.
Parameters: publicKey - the public key of the identity whose signature isgoing to be verified. exception: InvalidKeyException - if the key is improperlyencoded, parameters are missing, and so on. |
engineSign | abstract protected byte[] engineSign() throws SignatureException(Code) | | Returns the signature bytes of all the data
updated so far.
The format of the signature depends on the underlying
signature scheme.
the signature bytes of the signing operation's result. exception: SignatureException - if the engine is notinitialized properly. |
engineSign | protected int engineSign(byte[] outbuf, int offset, int len) throws SignatureException(Code) | | Finishes this signature operation and stores the resulting signature
bytes in the provided buffer outbuf , starting at
offset .
The format of the signature depends on the underlying
signature scheme.
The signature implementation is reset to its initial state
(the state it was in after a call to one of the
engineInitSign methods)
and can be reused to generate further signatures with the same private
key.
This method should be abstract, but we leave it concrete for
binary compatibility. Knowledgeable providers should override this
method.
Parameters: outbuf - buffer for the signature result. Parameters: offset - offset into outbuf where the signature isstored. Parameters: len - number of bytes within outbuf allotted for thesignature.Both this default implementation and the SUN provider do notreturn partial digests. If the value of this parameter is lessthan the actual signature length, this method will throw aSignatureException.This parameter is ignored if its value is greater than or equal tothe actual signature length. the number of bytes placed into outbuf exception: SignatureException - if an error occurs or len is less than the actual signature length. since: 1.2 |
engineUpdate | abstract protected void engineUpdate(byte b) throws SignatureException(Code) | | Updates the data to be signed or verified
using the specified byte.
Parameters: b - the byte to use for the update. exception: SignatureException - if the engine is not initializedproperly. |
engineUpdate | abstract protected void engineUpdate(byte[] b, int off, int len) throws SignatureException(Code) | | Updates the data to be signed or verified, using the
specified array of bytes, starting at the specified offset.
Parameters: b - the array of bytes Parameters: off - the offset to start from in the array of bytes Parameters: len - the number of bytes to use, starting at offset exception: SignatureException - if the engine is not initialized properly |
engineVerify | abstract protected boolean engineVerify(byte[] sigBytes) throws SignatureException(Code) | | Verifies the passed-in signature.
Parameters: sigBytes - the signature bytes to be verified. true if the signature was verified, false if not. exception: SignatureException - if the engine is not initialized properly, or the passed-in signature is improperly encoded or of the wrong type, etc. |
engineVerify | protected boolean engineVerify(byte[] sigBytes, int offset, int length) throws SignatureException(Code) | | Verifies the passed-in signature in the specified array
of bytes, starting at the specified offset.
Note: Subclasses should overwrite the default implementation.
Parameters: sigBytes - the signature bytes to be verified. Parameters: offset - the offset to start from in the array of bytes. Parameters: length - the number of bytes to use, starting at offset. true if the signature was verified, false if not. exception: SignatureException - if the engine is not initialized properly, or the passed-in signature is improperly encoded or of the wrong type, etc. |
|
|