java.lang.Object | |
↳ | javax.crypto.ExemptionMechanism |
This class implements the functionality of an exemption mechanism such as key recovery, key weakening, or key escrow.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a
ExemptionMechanism instance.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Generates the result key blob for this exemption mechanism and stores it
into the
output buffer.
| |||||||||||
Generates the result key blob for this exemption mechanism.
| |||||||||||
Generates the result key blob for this exemption mechanism and stores it
into the
output buffer at offset outputOffset .
| |||||||||||
Returns a new
ExemptionMechansm instance that provides the
specified exemption mechanism algorithm from the specified provider.
| |||||||||||
Returns a new
ExemptionMechanism instance that provides the
specified exemption mechanism algorithm from the specified provider.
| |||||||||||
Returns a new
ExemptionMechanism instance that provides the
specified exemption mechanism algorithm.
| |||||||||||
Returns the name of this
ExemptionMechanism .
| |||||||||||
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).
| |||||||||||
Returns the provider of this
ExemptionMechanism instance.
| |||||||||||
Initializes this
ExemptionMechanism instance with the
specified key and algorithm parameters.
| |||||||||||
Initializes this
ExemptionMechanism instance with the
specified key.
| |||||||||||
Initializes this
ExemptionMechanism instance with the
specified key and algorithm parameters.
| |||||||||||
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a ExemptionMechanism
instance.
exmechSpi | the implementation delegate. |
---|---|
provider | the associated provider. |
mechanism | the name of the mechanism. |
Generates the result key blob for this exemption mechanism and stores it
into the output
buffer.
output | the output buffer for the result key blob. |
---|
output
buffer.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. |
Generates the result key blob for this exemption mechanism.
IllegalStateException | if this ExemptionMechanism instance is not
initialized. |
---|---|
ExemptionMechanismException | if error(s) occur during generation. |
Generates the result key blob for this exemption mechanism and stores it
into the output
buffer at offset outputOffset
.
output | the output buffer for the result key blob. |
---|---|
outputOffset | the offset in the output buffer to start. |
output
buffer.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. |
Returns a new ExemptionMechansm
instance that provides the
specified exemption mechanism algorithm from the specified provider.
algorithm | the name of the requested exemption mechanism. |
---|---|
provider | the name of the provider that is providing the algorithm. |
ExemptionMechanism
instance.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 .
|
Returns a new ExemptionMechanism
instance that provides the
specified exemption mechanism algorithm from the specified provider.
The provider
supplied does not have to be registered.
algorithm | the name of the requested exemption mechanism. |
---|---|
provider | the provider that is providing the algorithm. |
ExemptionMechanism
instance.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 .
|
Returns a new ExemptionMechanism
instance that provides the
specified exemption mechanism algorithm.
algorithm | the name of the requested exemption mechanism. |
---|
ExemptionMechanism
instance.NoSuchAlgorithmException | if the specified algorithm is not available by any provider. |
---|---|
NullPointerException | if the algorithm parameter is null .
|
Returns the name of this ExemptionMechanism
.
ExemptionMechanism
.
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).
inputLen | the specified input length (in bytes). |
---|
IllegalStateException | if this ExemptionMechanism instance is not
initialized.
|
---|
Returns the provider of this ExemptionMechanism
instance.
ExemptionMechanism
instance.
Initializes this ExemptionMechanism
instance with the
specified key and algorithm parameters.
key | the key to initialize this instance with. |
---|---|
param | the parameters for this exemption mechanism algorithm. |
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. |
Initializes this ExemptionMechanism
instance with the
specified key.
key | the key to initialize this instance with. |
---|
InvalidKeyException | if the key cannot be used to initialize this mechanism. |
---|---|
ExemptionMechanismException | if error(s) occur during initialization. |
Initializes this ExemptionMechanism
instance with the
specified key and algorithm parameters.
key | the key to initialize this instance with. |
---|---|
param | the parameters for this exemption mechanism algorithm. |
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. |
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.
key | the key to verify. |
---|
ExemptionMechanism
instance has been generated successfully.ExemptionMechanismException | if an error occurs while determining whether the result blob has been generated successfully. |
---|
Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.
Note that objects that override finalize
are significantly more expensive than
objects that don't. Finalizers may be run a long time after the object is no longer
reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup.
Note also that finalizers are run on a single VM-wide finalizer thread,
so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary
for a class that has a native peer and needs to call a native method to destroy that peer.
Even then, it's better to provide an explicit close
method (and implement
Closeable
), and insist that callers manually dispose of instances. This
works well for something like files, but less well for something like a BigInteger
where typical calling code would have to deal with lots of temporaries. Unfortunately,
code that creates lots of temporaries is the worst kind of code from the point of view of
the single finalizer thread.
If you must use finalizers, consider at least providing your own
ReferenceQueue
and having your own thread process that queue.
Unlike constructors, finalizers are not automatically chained. You are responsible for
calling super.finalize()
yourself.
Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.