java.lang.Object | |
↳ | javax.crypto.Mac |
This class provides the public API for Message Authentication Code (MAC) algorithms.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
Mac instance. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clones this
Mac instance and the underlying implementation. | |||||||||||
Computes the digest of this MAC based on the data previously specified in
update(byte) calls and stores the digest in the specified
output buffer at offset outOffset . | |||||||||||
Computes the digest of this MAC based on the data previously specified in
update(byte) calls.
| |||||||||||
Computes the digest of this MAC based on the data previously specified on
update(byte) calls and on the final bytes specified by
input
(or based on those bytes only). | |||||||||||
Returns the name of the MAC algorithm.
| |||||||||||
Creates a new
Mac instance that provides the specified MAC
algorithm from the specified provider. | |||||||||||
Creates a new
Mac instance that provides the specified MAC
algorithm. | |||||||||||
Creates a new
Mac instance that provides the specified MAC
algorithm from the specified provider. | |||||||||||
Returns the length of this MAC (in bytes).
| |||||||||||
Returns the provider of this
Mac instance. | |||||||||||
Initializes this
Mac instance with the specified key and
algorithm parameters. | |||||||||||
Initializes this
Mac instance with the specified key. | |||||||||||
Resets this
Mac instance to its initial state. | |||||||||||
Copies the buffer provided as input for further processing.
| |||||||||||
Updates this
Mac instance with the specified byte. | |||||||||||
Updates this
Mac instance with the data from the specified buffer
input from the specified offset and length len . | |||||||||||
Updates this
Mac instance with the data from the specified
buffer, starting at position(), including the next
remaining() bytes. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Creates a new Mac
instance.
macSpi | the implementation delegate. |
---|---|
provider | the implementation provider. |
algorithm | the name of the MAC algorithm. |
Clones this Mac
instance and the underlying implementation.
CloneNotSupportedException | if the underlying implementation does not support cloning. |
---|
Computes the digest of this MAC based on the data previously specified in
update(byte) calls and stores the digest in the specified output
buffer at offset outOffset
.
This Mac
instance is reverted to its initial state and can be
used to start the next MAC computation with the same parameters or
initialized with different parameters.
output | the output buffer |
---|---|
outOffset | the offset in the output buffer |
ShortBufferException | if the specified output buffer is either too small for the
digest to be stored, the specified output buffer is null , or the specified offset is negative or past the length
of the output buffer. |
---|---|
IllegalStateException | if this MAC is not initialized. |
Computes the digest of this MAC based on the data previously specified in update(byte) calls.
This Mac
instance is reverted to its initial state and can be
used to start the next MAC computation with the same parameters or
initialized with different parameters.
IllegalStateException | if this MAC is not initialized. |
---|
Computes the digest of this MAC based on the data previously specified on
update(byte) calls and on the final bytes specified by input
(or based on those bytes only).
This Mac
instance is reverted to its initial state and can be
used to start the next MAC computation with the same parameters or
initialized with different parameters.
input | the final bytes. |
---|
IllegalStateException | if this MAC is not initialized. |
---|
Returns the name of the MAC algorithm.
Creates a new Mac
instance that provides the specified MAC
algorithm from the specified provider.
algorithm | the name of the requested MAC algorithm. |
---|---|
provider | the name of the provider that is providing the algorithm. |
Mac
instance.NoSuchAlgorithmException | if the specified algorithm is not provided by the specified provider. |
---|---|
NoSuchProviderException | if the specified provider is not available. |
IllegalArgumentException | if the specified provider name is null or empty. |
NullPointerException | if algorithm is null |
Creates a new Mac
instance that provides the specified MAC
algorithm.
algorithm | the name of the requested MAC algorithm. |
---|
Mac
instance.NoSuchAlgorithmException | if the specified algorithm is not available by any provider. |
---|---|
NullPointerException | if algorithm is null . |
Creates a new Mac
instance that provides the specified MAC
algorithm from the specified provider.
algorithm | the name of the requested MAC algorithm. |
---|---|
provider | the provider that is providing the algorithm. |
Mac
instance.NoSuchAlgorithmException | if the specified algorithm is not provided by the specified provider. |
---|---|
IllegalArgumentException | if provider is null . |
NullPointerException | if algorithm is null . |
Returns the length of this MAC (in bytes).
Returns the provider of this Mac
instance.
Mac
instance.Initializes this Mac
instance with the specified key and
algorithm parameters.
key | the key to initialize this algorithm. |
---|---|
params | the parameters for this algorithm. |
InvalidKeyException | if the specified key cannot be used to initialize this algorithm, or it is null. |
---|---|
InvalidAlgorithmParameterException | if the specified parameters cannot be used to initialize this algorithm. |
Initializes this Mac
instance with the specified key.
key | the key to initialize this algorithm. |
---|
InvalidKeyException | if initialization fails because the provided key is null . |
---|---|
RuntimeException | if the specified key cannot be used to initialize this algorithm. |
Resets this Mac
instance to its initial state.
This Mac
instance is reverted to its initial state and can be
used to start the next MAC computation with the same parameters or
initialized with different parameters.
Copies the buffer provided as input for further processing.
input | the buffer. |
---|
IllegalStateException | if this MAC is not initialized. |
---|
Updates this Mac
instance with the specified byte.
input | the byte |
---|
IllegalStateException | if this MAC is not initialized. |
---|
Updates this Mac
instance with the data from the specified buffer
input
from the specified offset
and length len
.
input | the buffer. |
---|---|
offset | the offset in the buffer. |
len | the length of the data in the buffer. |
IllegalStateException | if this MAC is not initialized. |
---|---|
IllegalArgumentException | if offset and len do not specified a valid
chunk in input buffer. |
Updates this Mac
instance with the data from the specified
buffer, starting at position(), including the next
remaining() bytes.
input | the buffer. |
---|
IllegalStateException | if this MAC is not initialized. |
---|