javax.crypto

Class ExemptionMechanism

public class ExemptionMechanism extends Object

An exemption mechanism, which will conditionally allow cryptography where it is not normally allowed, implements things such as key recovery, key weakening, or key escrow.

Implementation note: this class is present for API-compatibility only; it is not actually used anywhere in this library and this library does not, in general, support crypto weakening.

Since: 1.4

Constructor Summary
protected ExemptionMechanism(ExemptionMechanismSpi emSpi, Provider provider, String mechanism)
Method Summary
protected voidfinalize()
byte[]genExemptionBlob()
intgenExemptionBlob(byte[] output)
intgenExemptionBlob(byte[] output, int outputOffset)
static ExemptionMechanismgetInstance(String mechanism)
Create an instance of ExemptionMechanism for a designated mechanism from the first Security Provider offering it.
static ExemptionMechanismgetInstance(String mechanism, String provider)
Create an instance of ExemptionMechanism for a designated mechanism from a named provider.
static ExemptionMechanismgetInstance(String mechanism, Provider provider)
Create an instance of ExemptionMechanism for a designated mechanism from a designated provider.
StringgetName()
intgetOutputSize(int inputLength)
ProvidergetProvider()
voidinit(Key key)
voidinit(Key key, AlgorithmParameters params)
voidinit(Key key, AlgorithmParameterSpec params)
booleanisCryptoAllowed(Key key)

Constructor Detail

ExemptionMechanism

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

Method Detail

finalize

protected void finalize()

genExemptionBlob

public final byte[] genExemptionBlob()

genExemptionBlob

public final int genExemptionBlob(byte[] output)

genExemptionBlob

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

getInstance

public static final ExemptionMechanism getInstance(String mechanism)
Create an instance of ExemptionMechanism for a designated mechanism from the first Security Provider offering it.

Parameters: mechanism the name of the exemption mechanism to create.

Returns: a newly created instance of ExemptionMechanism.

Throws: IllegalArgumentException if the provider is null. NoSuchAlgorithmException if no such exemption mechanism is available from any known Security Provider. IllegalArgumentException if mechanism is null or is an empty string.

getInstance

public static final ExemptionMechanism getInstance(String mechanism, String provider)
Create an instance of ExemptionMechanism for a designated mechanism from a named provider.

Parameters: mechanism the name of the exemption mechanism to create. provider the security provider to provide the exemption mechanism.

Returns: a newly created instance of ExemptionMechanism.

Throws: NoSuchAlgorithmException if no such exemption mechanism is available from the named provider. NoSuchProviderException if no Security Provider with the designated name is known to the underlying JVM. IllegalArgumentException if either mechanism or provider is null, or if mechanism is an empty string.

getInstance

public static final ExemptionMechanism getInstance(String mechanism, Provider provider)
Create an instance of ExemptionMechanism for a designated mechanism from a designated provider.

Parameters: mechanism the name of the exemption mechanism to create. provider the security provider to provide the exemption mechanism.

Returns: a newly created instance of ExemptionMechanism.

Throws: NoSuchAlgorithmException if an exemption mechanism could not be created. IllegalArgumentException if either mechanism or provider is null, or if mechanism is an empty string.

getName

public final String getName()

getOutputSize

public final int getOutputSize(int inputLength)

getProvider

public final Provider getProvider()

init

public final void init(Key key)

init

public final void init(Key key, AlgorithmParameters params)

init

public final void init(Key key, AlgorithmParameterSpec params)

isCryptoAllowed

public final boolean isCryptoAllowed(Key key)