Save This Page
Home » openjdk-7 » javax » crypto » [javadoc | source]
javax.crypto
public class: ExemptionMechanism [javadoc | source]
java.lang.Object
   javax.crypto.ExemptionMechanism
This class provides the functionality of an exemption mechanism, examples of which are key recovery, key weakening, and key escrow.

Applications or applets that use an exemption mechanism may be granted stronger encryption capabilities than those which don't.

Constructor:
 protected ExemptionMechanism(ExemptionMechanismSpi exmechSpi,
    Provider provider,
    String mechanism) 
    Creates a ExemptionMechanism object.
    Parameters:
    exmechSpi - the delegate
    provider - the provider
    mechanism - the exemption mechanism
Method from javax.crypto.ExemptionMechanism Summary:
finalize,   genExemptionBlob,   genExemptionBlob,   genExemptionBlob,   getInstance,   getInstance,   getInstance,   getName,   getOutputSize,   getProvider,   init,   init,   init,   isCryptoAllowed
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.crypto.ExemptionMechanism Detail:
 protected  void finalize() 
    Ensures that the key stored away by this ExemptionMechanism object will be wiped out when there are no more references to it.
 public final byte[] genExemptionBlob() throws IllegalStateException, ExemptionMechanismException 
    Generates the exemption mechanism key blob.
 public final int genExemptionBlob(byte[] output) throws IllegalStateException, ShortBufferException, ExemptionMechanismException 
    Generates the exemption mechanism key blob, and stores the result in the output buffer.

    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 getOutputSize to determine how big the output buffer should be.

 public final int genExemptionBlob(byte[] output,
    int outputOffset) throws IllegalStateException, ShortBufferException, ExemptionMechanismException 
    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 getOutputSize to determine how big the output buffer should be.

 public static final ExemptionMechanism getInstance(String algorithm) throws NoSuchAlgorithmException 
    Returns an ExemptionMechanism object that implements the specified exemption mechanism algorithm.

    This method traverses the list of registered security Providers, starting with the most preferred Provider. A new ExemptionMechanism object encapsulating the ExemptionMechanismSpi implementation from the first Provider that supports the specified algorithm is returned.

    Note that the list of registered providers may be retrieved via the Security.getProviders() method.

 public static final ExemptionMechanism getInstance(String algorithm,
    String provider) throws NoSuchAlgorithmException, NoSuchProviderException 
    Returns an ExemptionMechanism object that implements the specified exemption mechanism algorithm.

    A new ExemptionMechanism object encapsulating the ExemptionMechanismSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list.

    Note that the list of registered providers may be retrieved via the Security.getProviders() method.

 public static final ExemptionMechanism getInstance(String algorithm,
    Provider provider) throws NoSuchAlgorithmException 
    Returns an ExemptionMechanism object that implements the specified exemption mechanism algorithm.

    A new ExemptionMechanism object encapsulating the ExemptionMechanismSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.

 public final String getName() 
    Returns the exemption mechanism name of this ExemptionMechanism object.

    This is the same name that was specified in one of the getInstance calls that created this ExemptionMechanism object.

 public final int getOutputSize(int inputLen) throws IllegalStateException 
    Returns the length in bytes that an output buffer would need to be in order to hold the result of the next genExemptionBlob operation, given the input length inputLen (in bytes).

    The actual output length of the next genExemptionBlob call may be smaller than the length returned by this method.

 public final Provider getProvider() 
    Returns the provider of this ExemptionMechanism object.
 public final  void init(Key key) throws InvalidKeyException, ExemptionMechanismException 
    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.

 public final  void init(Key key,
    AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException, ExemptionMechanismException 
    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.

 public final  void init(Key key,
    AlgorithmParameters params) throws InvalidKeyException, InvalidAlgorithmParameterException, ExemptionMechanismException 
    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.

 public final boolean isCryptoAllowed(Key key) throws ExemptionMechanismException 
    Returns whether the result blob has been generated successfully by this exemption mechanism.

    The method also makes sure that the key passed in is the same as the one this exemption mechanism used in initializing and generating phases.