Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

ExemptionMechanism

extends Object
java.lang.Object
   ↳ javax.crypto.ExemptionMechanism

Class Overview

This class implements the functionality of an exemption mechanism such as key recovery , key weakening , or key escrow .

Summary

Protected Constructors
ExemptionMechanism ( ExemptionMechanismSpi exmechSpi, Provider provider, String mechanism)
Creates a ExemptionMechanism instance.
Public Methods
final int genExemptionBlob (byte[] output)
Generates the result key blob for this exemption mechanism and stores it into the output buffer.
final byte[] genExemptionBlob ()
Generates the result key blob for this exemption mechanism.
final int genExemptionBlob (byte[] output, int outputOffset)
Generates the result key blob for this exemption mechanism and stores it into the output buffer at offset outputOffset .
final static ExemptionMechanism getInstance ( String algorithm, String provider)
Returns a new ExemptionMechansm instance that provides the specified exemption mechanism algorithm from the specified provider.
final static ExemptionMechanism getInstance ( String algorithm, Provider provider)
Returns a new ExemptionMechanism instance that provides the specified exemption mechanism algorithm from the specified provider.
final static ExemptionMechanism getInstance ( String algorithm)
Returns a new ExemptionMechanism instance that provides the specified exemption mechanism algorithm.
final String getName ()
Returns the name of this ExemptionMechanism .
final int getOutputSize (int inputLen)
Returns the size in bytes for the output buffer needed to hold the output of the next genExemptionBlob() call, given the specified inputLen (in bytes).
final Provider getProvider ()
Returns the provider of this ExemptionMechanism instance.
final void init ( Key key, AlgorithmParameterSpec param)
Initializes this ExemptionMechanism instance with the specified key and algorithm parameters.
final void init ( Key key)
Initializes this ExemptionMechanism instance with the specified key.
final void init ( Key key, AlgorithmParameters param)
Initializes this ExemptionMechanism instance with the specified key and algorithm parameters.
final boolean isCryptoAllowed ( Key key)
Returns whether the result blob for this ExemptionMechanism instance has been generated successfully and that the specified key is the same as the one that was used to initialize and generate.
Protected Methods
void finalize ()
Override to clear any key state in the instance.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected ExemptionMechanism ( ExemptionMechanismSpi exmechSpi, Provider provider, String mechanism)

Added in API level 1

Creates a ExemptionMechanism instance.

Parameters
exmechSpi the implementation delegate.
provider the associated provider.
mechanism the name of the mechanism.

Public Methods

public final int genExemptionBlob (byte[] output)

Added in API level 1

Generates the result key blob for this exemption mechanism and stores it into the output buffer.

Parameters
output the output buffer for the result key blob.
Returns
  • the number of bytes written to the output buffer.
Throws
IllegalStateException if this ExemptionMechanism instance is not initialized.
ShortBufferException if the provided buffer is too small for the result key blob.
ExemptionMechanismException if error(s) occur during generation.

public final byte[] genExemptionBlob ()

Added in API level 1

Generates the result key blob for this exemption mechanism.

Returns
  • the result key blob for this exemption mechanism.
Throws
IllegalStateException if this ExemptionMechanism instance is not initialized.
ExemptionMechanismException if error(s) occur during generation.

public final int genExemptionBlob (byte[] output, int outputOffset)

Added in API level 1

Generates the result key blob for this exemption mechanism and stores it into the output buffer at offset outputOffset .

Parameters
output the output buffer for the result key blob.
outputOffset the offset in the output buffer to start.
Returns
  • the number of bytes written to the output buffer.
Throws
IllegalStateException if this ExemptionMechanism instance is not initialized.
ShortBufferException if the provided buffer is too small for the result key blob.
ExemptionMechanismException if error(s) occur during generation.

public static final ExemptionMechanism getInstance ( String algorithm, String provider)

Added in API level 1

Returns a new ExemptionMechansm instance that provides the specified exemption mechanism algorithm from the specified provider.

Parameters
algorithm the name of the requested exemption mechanism.
provider the name of the provider that is providing the algorithm.
Returns
  • the new ExemptionMechanism instance.
Throws
NoSuchAlgorithmException if the specified algorithm is not provided by the specified provider.
NoSuchProviderException if the specified provider is not available.
NullPointerException if the algorithm parameter is null .
IllegalArgumentException if the provider parameter is null .

public static final ExemptionMechanism getInstance ( String algorithm, Provider provider)

Added in API level 1

Returns a new ExemptionMechanism instance that provides the specified exemption mechanism algorithm from the specified provider.

Parameters
algorithm the name of the requested exemption mechanism.
provider the provider that is providing the algorithm.
Returns
  • the new ExemptionMechanism instance.
Throws
NoSuchAlgorithmException if the specified algorithm is not provided by the specified provider.
NullPointerException if the algorithm parameter is null .
IllegalArgumentException if the provider parameter is null .

public static final ExemptionMechanism getInstance ( String algorithm)

Added in API level 1

Returns a new ExemptionMechanism instance that provides the specified exemption mechanism algorithm.

Parameters
algorithm the name of the requested exemption mechanism.
Returns
  • the new ExemptionMechanism instance.
Throws
NoSuchAlgorithmException if the specified algorithm is not available by any provider.
NullPointerException if the algorithm parameter is null .

public final String getName ()

Added in API level 1

Returns the name of this ExemptionMechanism .

Returns
  • the name of this ExemptionMechanism .

public final int getOutputSize (int inputLen)

Added in API level 1

Returns the size in bytes for the output buffer needed to hold the output of the next genExemptionBlob() call, given the specified inputLen (in bytes).

Parameters
inputLen the specified input length (in bytes).
Returns
  • the size in bytes for the output buffer.
Throws
IllegalStateException if this ExemptionMechanism instance is not initialized.

public final Provider getProvider ()

Added in API level 1

Returns the provider of this ExemptionMechanism instance.

Returns
  • the provider of this ExemptionMechanism instance.

public final void init ( Key key, AlgorithmParameterSpec param)

Added in API level 1

Initializes this ExemptionMechanism instance with the specified key and algorithm parameters.

Parameters
key the key to initialize this instance with.
param the parameters for this exemption mechanism algorithm.
Throws
InvalidKeyException if the key cannot be used to initialize this mechanism.
InvalidAlgorithmParameterException the the parameters cannot be used to initialize this mechanism.
ExemptionMechanismException if error(s) occur during initialization.

public final void init ( Key key)

Added in API level 1

Initializes this ExemptionMechanism instance with the specified key.

Parameters
key the key to initialize this instance with.
Throws
InvalidKeyException if the key cannot be used to initialize this mechanism.
ExemptionMechanismException if error(s) occur during initialization.

public final void init ( Key key, AlgorithmParameters param)

Added in API level 1

Initializes this ExemptionMechanism instance with the specified key and algorithm parameters.

Parameters
key the key to initialize this instance with.
param the parameters for this exemption mechanism algorithm.
Throws
InvalidKeyException if the key cannot be used to initialize this mechanism.
InvalidAlgorithmParameterException if the parameters cannot be used to initialize this mechanism.
ExemptionMechanismException if error(s) occur during initialization.

public final boolean isCryptoAllowed ( Key key)

Added in API level 1

Returns whether the result blob for this ExemptionMechanism instance has been generated successfully and that the specified key is the same as the one that was used to initialize and generate.

Parameters
key the key to verify.
Returns
  • whether the result blob for this ExemptionMechanism instance has been generated successfully.
Throws
ExemptionMechanismException if an error occurs while determining whether the result blob has been generated successfully.

Protected Methods

protected void finalize ()

Added in API level 1

Override to clear any key state in the instance.