ExemptionMechanism (GNU cryptographic primitives and tools)
Keywords: javax.crypto.ExemptionMechanism,ExemptionMechanism class

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.crypto
Class ExemptionMechanism

    java.lang.Object
      |
      +--javax.crypto.ExemptionMechanism

public class ExemptionMechanism
extends java.lang.Object

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.

IMPLEMENTATION NOTE: This implementation does not support exemption mechanisms. As a result, all invocations to the declared methods throw one of exceptions declared in their signature.

Since:
  1.4

Constructor Summary
`protected` | `ExemptionMechanism(ExemptionMechanismSpi exmechSpi, java.security.Provider provider, java.lang.String mechanism)` Creates a ExemptionMechanism object.

Method Summary
`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.
`byte[]` | `genExemptionBlob()` Generates the exemption mechanism key blob.
`int` | `genExemptionBlob(byte[] output)` Generates the exemption mechanism key blob, and stores the result in the output buffer.
`int` | `genExemptionBlob(byte[] output, int outputOffset)` Generates the exemption mechanism key blob, and stores the result in the `output` buffer, starting at `outputOffset` inclusive.
`static ExemptionMechanism` | `getInstance(java.lang.String mechanism)` Generates a ExemptionMechanism object that implements the specified exemption mechanism.
`static ExemptionMechanism` | `getInstance(java.lang.String mechanism, java.security.Provider provider)` Generates a ExemptionMechanism object for the specified exemption mechanism from the specified provider.
`static ExemptionMechanism` | `getInstance(java.lang.String mechanism, java.lang.String provider)` Generates a ExemptionMechanism object for the specified exemption mechanism from the specified provider.
`java.lang.String` | `getName()` Returns the exemption mechanism name of this ExemptionMechanism object.
`int` | `getOutputSize(int inputLen)` 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).
`java.security.Provider` | `getProvider()` Returns the provider of this ExemptionMechanism object.
`void` | `init(java.security.Key key)` Initializes this exemption mechanism with a key.
`void` | `init(java.security.Key key, java.security.AlgorithmParameters params)` Initializes this exemption mechanism with a key and a set of algorithm parameters.
`void` | `init(java.security.Key key, java.security.spec.AlgorithmParameterSpec params)` Initializes this exemption mechanism with a key and a set of algorithm parameters.
`boolean` | `isCryptoAllowed(java.security.Key key)` Returns whether the result blob has been generated successfully by this exemption mechanism.

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ExemptionMechanism

    protected ExemptionMechanism(ExemptionMechanismSpi exmechSpi,
                                 java.security.Provider provider,
                                 java.lang.String mechanism)

  Creates a ExemptionMechanism object.

Parameters:
  `exmechSpi` - the delegate.
  `provider` - the provider.
  `mechanism` - the exemption mechanism.

Method Detail

### getInstance

    public static final ExemptionMechanism getInstance(java.lang.String mechanism)
                                                throws java.security.NoSuchAlgorithmException

  Generates a ExemptionMechanism object that implements the specified exemption mechanism. If the default provider package provides an implementation of the requested exemption mechanism, an instance of ExemptionMechanism containing that implementation is returned. If the exemption mechanism is not available in the default provider package, other provider packages are searched.

  IMPLEMENTATION NOTE: This implementation always throws a `NoSuchAlgorithmException`.

  Parameters:
    `mechanism` - the standard name of the requested exemption mechanism. See Appendix A in the Java Cryptography Extension Reference Guide for information about standard exemption mechanism names.
  Returns:
    the new ExemptionMechanism object
  Throws:
    `java.security.NoSuchAlgorithmException` - if the specified exemption mechanism is not available in the default provider package or any of the other provider packages that were searched.

### getInstance

    public static final ExemptionMechanism getInstance(java.lang.String mechanism,
                                                       java.lang.String provider)
                                                throws java.security.NoSuchAlgorithmException,
                                                       java.security.NoSuchProviderException

  Generates a ExemptionMechanism object for the specified exemption mechanism from the specified provider.

  IMPLEMENTATION NOTE: This implementation always throws a `NoSuchAlgorithmException`, except when the designated `provider` is null, in which case it throws an `IllegalArgumentException` .

  Parameters:
    `mechanism` - the standard name of the requested exemption mechanism. See Appendix A in the Java Cryptography Extension Reference Guide for information about standard exemption mechanism names.
    `provider` - the name of the provider.
  Returns:
    the new ExemptionMechanism object.
  Throws:
    `java.security.NoSuchAlgorithmException` - if the specified exemption mechanism is not available from the specified provider.
    `java.security.NoSuchProviderException` - if the specified provider has not been configured.
    `java.lang.IllegalArgumentException` - if the provider is null.

### getInstance

    public static final ExemptionMechanism getInstance(java.lang.String mechanism,
                                                       java.security.Provider provider)
                                                throws java.security.NoSuchAlgorithmException

  Generates a ExemptionMechanism object for the specified exemption mechanism from the specified provider. Note: the provider doesn't have to be registered.

  IMPLEMENTATION NOTE: This implementation always throws a `NoSuchAlgorithmException`, except when the designated `provider` is null, in which case it throws an `IllegalArgumentException` .

  Parameters:
    `mechanism` - the standard name of the requested exemption mechanism. See Appendix A in the Java Cryptography Extension Reference Guide for information about standard exemption mechanism names.
    `provider` - the provider.
  Returns:
    the new ExemptionMechanism object.
  Throws:
    `java.security.NoSuchAlgorithmException` - if the specified exemption mechanism is not available from the specified provider.
    `java.lang.IllegalArgumentException` - if the provider is null.

### getName

    public final java.lang.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.

  Returns:
    the exemption mechanism name of this ExemptionMechanism object.

### getProvider

    public final java.security.Provider getProvider()

  Returns the provider of this ExemptionMechanism object.

  Returns:
    the provider of this ExemptionMechanism object.

### isCryptoAllowed

    public final boolean isCryptoAllowed(java.security.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.

  IMPLEMENTATION NOTE: This implementation always throws a `ExemptionMechanismException`

  Parameters:
    `key` - the key the crypto is going to use.
  Returns:
    whether the result blob of the same key has been generated successfully by this exemption mechanism.
  Throws:
    `ExemptionMechanismException` - if problem(s) encountered while determining whether the result blob has been generated successfully by this exemption mechanism object.

### getOutputSize

    public final int getOutputSize(int inputLen)
                            throws java.lang.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.

  IMPLEMENTATION NOTE: This implementation always throws an `IllegalStateException`

  Parameters:
    `inputLen` - the input length (in bytes).
  Returns:
    the required output buffer size (in bytes).
  Throws:
    `java.lang.IllegalStateException` - if this exemption mechanism is in a wrong state (e.g., has not yet been initialized).

### init

    public final void init(java.security.Key key)
                    throws java.security.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.

  IMPLEMENTATION NOTE: This implementation always throws an `ExemptionMechanismException`

  Parameters:
    `key` - the key for this exemption mechanism.
  Throws:
    `java.security.InvalidKeyException` - if the given key is inappropriate for this exemption mechanism.
    `ExemptionMechanismException` - if problem(s) encountered in the process of initializing.

### init

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

  IMPLEMENTATION NOTE: This implementation always throws an `ExemptionMechanismException`

  Parameters:
    `key` - the key for this exemption mechanism.
    `params` - the algorithm parameters.
  Throws:
    `java.security.InvalidKeyException` - if the given key is inappropriate for this exemption mechanism.
    `java.security.InvalidAlgorithmParameterException` - if the given algorithm parameters are inappropriate for this exemption mechanism.
    `ExemptionMechanismException` - if problem(s) encountered in the process of initializing.

### init

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

  IMPLEMENTATION NOTE: This implementation always throws an `ExemptionMechanismException`

  Parameters:
    `key` - the key for this exemption mechanism.
    `params` - the algorithm parameters.
  Throws:
    `java.security.InvalidKeyException` - if the given key is inappropriate for this exemption mechanism.
    `java.security.InvalidAlgorithmParameterException` - if the given algorithm parameters are inappropriate for this exemption mechanism.
    `ExemptionMechanismException` - if problem(s) encountered in the process of initializing.

### genExemptionBlob

    public final byte[] genExemptionBlob()
                                  throws java.lang.IllegalStateException,
                                         ExemptionMechanismException

  Generates the exemption mechanism key blob.

  IMPLEMENTATION NOTE: This implementation always throws an `ExemptionMechanismException`

  Returns:
    the new buffer with the result key blob.
  Throws:
    `java.lang.IllegalStateException` - if this exemption mechanism is in a wrong state (e.g., has not been initialized).
    `ExemptionMechanismException` - if problem(s) encountered in the process of generating.

### genExemptionBlob

    public final int genExemptionBlob(byte[] output)
                               throws java.lang.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.

  IMPLEMENTATION NOTE: This implementation always throws an `ExemptionMechanismException`

  Parameters:
    `output` - the buffer for the result.
  Returns:
    the number of bytes stored in output.
  Throws:
    `java.lang.IllegalStateException` - if this exemption mechanism is in a wrong state (e.g., has not been initialized).
    `ShortBufferException` - if the given output buffer is too small to hold the result.
    `ExemptionMechanismException` - if problem(s) encountered in the process of generating.

### genExemptionBlob

    public final int genExemptionBlob(byte[] output,
                                      int outputOffset)
                               throws java.lang.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.

  IMPLEMENTATION NOTE: This implementation always throws an `ExemptionMechanismException`

  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:
    `java.lang.IllegalStateException` - if this exemption mechanism is in a wrong state (e.g., has not been initialized).
    `ShortBufferException` - if the given output buffer is too small to hold the result.
    `ExemptionMechanismException` - if problem(s) encountered in the process of generating.

### finalize

    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.

  Overrides:
    `finalize` in class `java.lang.Object`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001, 2002, 2003, 2004 Free Software Foundation, Inc.