Skip to content

Most visited

Recently visited

navigation
Added in API level 1

SignatureSpi

public abstract class SignatureSpi
extends Object

java.lang.Object
   ↳ java.security.SignatureSpi
Known Direct Subclasses


SignatureSpi is the Service Provider Interface (SPI) definition for Signature.

See also:

Summary

Fields

protected SecureRandom appRandom

Implementation specific source of randomness.

Public constructors

SignatureSpi()

Public methods

Object clone()

Creates and returns a copy of this Object.

Protected methods

abstract Object engineGetParameter(String param)

This method was deprecated in API level 1. There is no generally accepted parameter naming convention.

AlgorithmParameters engineGetParameters()

Returns the AlgorithmParameters of this SignatureSpi instance.

void engineInitSign(PrivateKey privateKey, SecureRandom random)

Initializes this SignatureSpi instance for signing, using the private key of the identity whose signature is going to be generated and the specified source of randomness.

abstract void engineInitSign(PrivateKey privateKey)

Initializes this SignatureSpi instance for signing, using the private key of the identity whose signature is going to be generated.

abstract void engineInitVerify(PublicKey publicKey)

Initializes this SignatureSpi instance for signature verification, using the public key of the identity whose signature is going to be verified.

abstract void engineSetParameter(String param, Object value)

This method was deprecated in API level 1. Use engineSetParameter(AlgorithmParameterSpec)

void engineSetParameter(AlgorithmParameterSpec params)

Sets the specified AlgorithmParameterSpec.

int engineSign(byte[] outbuf, int offset, int len)

Generates and stores the signature of all updated data in the provided byte[] at the specified position with the specified length.

abstract byte[] engineSign()

Generates and returns the signature of all updated data.

abstract void engineUpdate(byte b)

Updates the data to be verified or to be signed, using the specified byte.

void engineUpdate(ByteBuffer input)

Updates the data to be verified or to be signed, using the specified ByteBuffer.

abstract void engineUpdate(byte[] b, int off, int len)

Updates the data to be verified or to be signed, using the given byte[], starting form the specified index for the specified length.

boolean engineVerify(byte[] sigBytes, int offset, int length)

Indicates whether the given sigBytes starting at index offset with length bytes can be verified using the public key or a certificate of the signer.

abstract boolean engineVerify(byte[] sigBytes)

Indicates whether the given sigBytes can be verified using the public key or a certificate of the signer.

Inherited methods

From class java.lang.Object

Fields

appRandom

Added in API level 1
SecureRandom appRandom

Implementation specific source of randomness.

Public constructors

SignatureSpi

Added in API level 1
SignatureSpi ()

Public methods

clone

Added in API level 1
Object clone ()

Creates and returns a copy of this Object. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.

Returns
Object a copy of this object.
Throws
CloneNotSupportedException

Protected methods

engineGetParameter

Added in API level 1
Object engineGetParameter (String param)

This method was deprecated in API level 1.
There is no generally accepted parameter naming convention.

Returns the value of the parameter with the specified name.

Parameters
param String: the name of the requested parameter value.
Returns
Object the value of the parameter with the specified name, maybe null.
Throws
InvalidParameterException if param is not a valid parameter for this SignatureSpi or an other error occurs.

engineGetParameters

Added in API level 1
AlgorithmParameters engineGetParameters ()

Returns the AlgorithmParameters of this SignatureSpi instance.

Returns
AlgorithmParameters the AlgorithmParameters of this SignatureSpi instance, maybe null.

engineInitSign

Added in API level 1
void engineInitSign (PrivateKey privateKey, 
                SecureRandom random)

Initializes this SignatureSpi instance for signing, using the private key of the identity whose signature is going to be generated and the specified source of randomness.

Parameters
privateKey PrivateKey: the private key.
random SecureRandom: the SecureRandom to use.
Throws
InvalidKeyException if privateKey is not valid.

engineInitSign

Added in API level 1
void engineInitSign (PrivateKey privateKey)

Initializes this SignatureSpi instance for signing, using the private key of the identity whose signature is going to be generated.

Parameters
privateKey PrivateKey: the private key.
Throws
InvalidKeyException if privateKey is not valid.

engineInitVerify

Added in API level 1
void engineInitVerify (PublicKey publicKey)

Initializes this SignatureSpi instance for signature verification, using the public key of the identity whose signature is going to be verified.

Parameters
publicKey PublicKey: the public key.
Throws
InvalidKeyException if publicKey is not valid.

engineSetParameter

Added in API level 1
void engineSetParameter (String param, 
                Object value)

This method was deprecated in API level 1.
Use engineSetParameter(AlgorithmParameterSpec)

Sets the specified parameter to the given value.

Parameters
param String: the name of the parameter.
value Object: the parameter value.
Throws
InvalidParameterException if the parameter is invalid, already set or is not allowed to be changed.

engineSetParameter

Added in API level 1
void engineSetParameter (AlgorithmParameterSpec params)

Sets the specified AlgorithmParameterSpec.

Parameters
params AlgorithmParameterSpec: the parameter to set.
Throws
InvalidAlgorithmParameterException if the parameter is invalid, already set or is not allowed to be changed.

engineSign

Added in API level 1
int engineSign (byte[] outbuf, 
                int offset, 
                int len)

Generates and stores the signature of all updated data in the provided byte[] at the specified position with the specified length.

This SignatureSpi instance is reset to the state of its last initialization for signing and thus can be used for another signature from the same identity.

Parameters
outbuf byte: the buffer to store the signature.
offset int: the index of the first byte in outbuf to store.
len int: the number of bytes allocated for the signature.
Returns
int the number of bytes stored in outbuf.
Throws
SignatureException if this SignatureSpi instance is not initialized properly.
IllegalArgumentException if offset or len are not valid in respect to outbuf.

engineSign

Added in API level 1
byte[] engineSign ()

Generates and returns the signature of all updated data.

This SignatureSpi instance is reset to the state of its last initialization for signing and thus can be used for another signature from the same identity.

Returns
byte[] the signature of all updated data.
Throws
SignatureException if this SignatureSpi instance is not initialized properly.

engineUpdate

Added in API level 1
void engineUpdate (byte b)

Updates the data to be verified or to be signed, using the specified byte.

Parameters
b byte: the byte to update with.
Throws
SignatureException if this SignatureSpi instance is not initialized properly.

engineUpdate

Added in API level 1
void engineUpdate (ByteBuffer input)

Updates the data to be verified or to be signed, using the specified ByteBuffer.

Parameters
input ByteBuffer: the ByteBuffer to update with.
Throws
RuntimeException since SignatureException is not specified for this method it throws a RuntimeException if underlying engineUpdate(byte[], int, int) throws SignatureException.

engineUpdate

Added in API level 1
void engineUpdate (byte[] b, 
                int off, 
                int len)

Updates the data to be verified or to be signed, using the given byte[], starting form the specified index for the specified length.

Parameters
b byte: the byte array to update with.
off int: the start index in b of the data.
len int: the number of bytes to use.
Throws
SignatureException if this SignatureSpi instance is not initialized properly.

engineVerify

Added in API level 1
boolean engineVerify (byte[] sigBytes, 
                int offset, 
                int length)

Indicates whether the given sigBytes starting at index offset with length bytes can be verified using the public key or a certificate of the signer.

This SignatureSpi instance is reset to the state of its last initialization for verifying and thus can be used to verify another signature of the same signer.

Parameters
sigBytes byte: the byte[] containing the signature to verify.
offset int: the start index in sigBytes of the signature
length int: the number of bytes allocated for the signature.
Returns
boolean true if the signature was verified, false otherwise.
Throws
SignatureException if this SignatureSpi instance is not initialized properly.
IllegalArgumentException if offset or length are not valid in respect to sigBytes.

engineVerify

Added in API level 1
boolean engineVerify (byte[] sigBytes)

Indicates whether the given sigBytes can be verified using the public key or a certificate of the signer.

This SignatureSpi instance is reset to the state of its last initialization for verifying and thus can be used to verify another signature of the same signer.

Parameters
sigBytes byte: the signature to verify.
Returns
boolean true if the signature was verified, false otherwise.
Throws
SignatureException if this SignatureSpi instance is not initialized properly.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.