# ExemptionMechanismSpi

public abstract class **ExemptionMechanismSpi** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
This class defines the *Service Provider Interface* (**SPI** )
for the `ExemptionMechanism` class.
All the abstract methods in this class must be implemented by each
cryptographic service provider who wishes to supply the implementation
of a particular exemption mechanism.

### Public Constructor Summary

|---|---|
|   | [ExemptionMechanismSpi](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#ExemptionMechanismSpi())() |

### Protected Method Summary

|---|---|
| abstract byte\[\] | [engineGenExemptionBlob](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineGenExemptionBlob())() Generates the exemption mechanism key blob. |
| abstract int | [engineGenExemptionBlob](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineGenExemptionBlob(byte[],%20int))(byte\[\] output, int outputOffset) Generates the exemption mechanism key blob, and stores the result in the `output` buffer, starting at `outputOffset` inclusive. |
| abstract int | [engineGetOutputSize](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineGetOutputSize(int))(int inputLen) Returns the length in bytes that an output buffer would need to be in order to hold the result of the next `https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineGenExemptionBlob(byte[],%20int)` operation, given the input length `inputLen` (in bytes). |
| abstract void | [engineInit](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineInit(java.security.Key))([Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html) key) Initializes this exemption mechanism with a key. |
| abstract void | [engineInit](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineInit(java.security.Key,%20java.security.spec.AlgorithmParameterSpec))([Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html) key, [AlgorithmParameterSpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/AlgorithmParameterSpec.html) params) Initializes this exemption mechanism with a key and a set of algorithm parameters. |
| abstract void | [engineInit](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineInit(java.security.Key,%20java.security.AlgorithmParameters))([Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html) key, [AlgorithmParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/AlgorithmParameters.html) params) Initializes this exemption mechanism with a key and a set of algorithm parameters. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**ExemptionMechanismSpi**
()

<br />

## Protected Methods

#### protected abstract byte\[\]
**engineGenExemptionBlob**
()

Generates the exemption mechanism key blob.

##### Returns

- the new buffer with the result key blob.

##### Throws

| [ExemptionMechanismException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismException.html) | if problem(s) encountered in the process of generating. |
|---|---|

#### protected abstract int
**engineGenExemptionBlob**
(byte\[\] output, int outputOffset)

Generates the exemption mechanism key blob, and stores the result in
the `output` buffer, starting at `outputOffset`
inclusive.

If the `output` buffer is too small to hold the result,
a `ShortBufferException` is thrown. In this case, repeat this
call with a larger output buffer. Use
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineGetOutputSize(int)` to determine
how big the output buffer should be.

##### Parameters

| output | the buffer for the result |
| outputOffset | the offset in `output` where the result is stored |
|---|---|

##### Returns

- the number of bytes stored in `output`

##### Throws

| [ShortBufferException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ShortBufferException.html) | if the given output buffer is too small to hold the result. |
| [ExemptionMechanismException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismException.html) | if problem(s) encountered in the process of generating. |
|---|---|

#### protected abstract int
**engineGetOutputSize**
(int inputLen)

Returns the length in bytes that an output buffer would need to be in
order to hold the result of the next
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineGenExemptionBlob(byte[],%20int)`
operation, given the input length `inputLen` (in bytes).

The actual output length of the next
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismSpi.html#engineGenExemptionBlob(byte[],%20int)`
call may be smaller than the length returned by this method.

##### Parameters

| inputLen | the input length (in bytes) |
|---|---|

##### Returns

- the required output buffer size (in bytes)

#### protected abstract void
**engineInit**
([Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html) key)

Initializes this exemption mechanism with a key.

If this exemption mechanism requires any algorithm parameters
that cannot be derived from the given `key`, the underlying
exemption mechanism implementation is supposed to generate the required
parameters itself (using provider-specific default values); in the case
that algorithm parameters must be specified by the caller, an
`InvalidKeyException` is raised.

##### Parameters

| key | the key for this exemption mechanism |
|---|---|

##### Throws

| [InvalidKeyException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidKeyException.html) | if the given key is inappropriate for this exemption mechanism. |
| [ExemptionMechanismException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismException.html) | if problem(s) encountered in the process of initializing. |
|---|---|

#### protected abstract void
**engineInit**
([Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html) key, [AlgorithmParameterSpec](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/spec/AlgorithmParameterSpec.html) params)

Initializes this exemption mechanism with a key and a set of algorithm
parameters.

If this exemption mechanism requires any algorithm parameters and
`params` is null, the underlying exemption mechanism
implementation is supposed to generate the required parameters
itself (using provider-specific default values); in the case that
algorithm parameters must be specified by the caller, an
`InvalidAlgorithmParameterException` is raised.

##### Parameters

| key | the key for this exemption mechanism |
| params | the algorithm parameters |
|---|---|

##### Throws

| [InvalidKeyException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidKeyException.html) | if the given key is inappropriate for this exemption mechanism. |
| [InvalidAlgorithmParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidAlgorithmParameterException.html) | if the given algorithm parameters are inappropriate for this exemption mechanism. |
| [ExemptionMechanismException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismException.html) | if problem(s) encountered in the process of initializing. |
|---|---|

#### protected abstract void
**engineInit**
([Key](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Key.html) key, [AlgorithmParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/AlgorithmParameters.html) params)

Initializes this exemption mechanism with a key and a set of algorithm
parameters.

If this exemption mechanism requires any algorithm parameters
and `params` is null, the underlying exemption mechanism
implementation is supposed to generate the required parameters
itself (using provider-specific default values); in the case that
algorithm parameters must be specified by the caller, an
`InvalidAlgorithmParameterException` is raised.

##### Parameters

| key | the key for this exemption mechanism |
| params | the algorithm parameters |
|---|---|

##### Throws

| [InvalidKeyException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidKeyException.html) | if the given key is inappropriate for this exemption mechanism. |
| [InvalidAlgorithmParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidAlgorithmParameterException.html) | if the given algorithm parameters are inappropriate for this exemption mechanism. |
| [ExemptionMechanismException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/ExemptionMechanismException.html) | if problem(s) encountered in the process of initializing. |
|---|---|