MacSpi
abstract class MacSpi
kotlin.Any | |
↳ | javax.crypto.MacSpi |
This class defines the Service Provider Interface (SPI) for the Mac
class. All the abstract methods in this class must be implemented by each cryptographic service provider who wishes to supply the implementation of a particular MAC algorithm.
Implementations are free to implement the Cloneable interface.
Summary
Public constructors | |
---|---|
MacSpi() |
Public methods | |
---|---|
open Any! |
clone() Returns a clone if the implementation is cloneable. |
Protected methods | |
---|---|
abstract ByteArray! |
Completes the MAC computation and resets the MAC for further use, maintaining the secret key that the MAC was initialized with. |
abstract Int |
Returns the length of the MAC in bytes. |
abstract Unit |
engineInit(key: Key!, params: AlgorithmParameterSpec!) Initializes the MAC with the given (secret) key and algorithm parameters. |
abstract Unit |
Resets the MAC for further use, maintaining the secret key that the MAC was initialized with. |
abstract Unit |
engineUpdate(input: Byte) Processes the given byte. |
abstract Unit |
engineUpdate(input: ByteArray!, offset: Int, len: Int) Processes the first |
open Unit |
engineUpdate(input: ByteBuffer!) Processes |
Public constructors
Public methods
clone
open fun clone(): Any!
Returns a clone if the implementation is cloneable.
Return | |
---|---|
Any! |
a clone if the implementation is cloneable. |
Exceptions | |
---|---|
java.lang.CloneNotSupportedException |
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned. |
java.lang.CloneNotSupportedException |
if this is called on an implementation that does not support Cloneable . |
Protected methods
engineDoFinal
protected abstract fun engineDoFinal(): ByteArray!
Completes the MAC computation and resets the MAC for further use, maintaining the secret key that the MAC was initialized with.
Return | |
---|---|
ByteArray! |
the MAC result. |
engineGetMacLength
protected abstract fun engineGetMacLength(): Int
Returns the length of the MAC in bytes.
Return | |
---|---|
Int |
the MAC length in bytes. |
engineInit
protected abstract fun engineInit(
key: Key!,
params: AlgorithmParameterSpec!
): Unit
Initializes the MAC with the given (secret) key and algorithm parameters.
Parameters | |
---|---|
key |
Key!: the (secret) key. |
params |
AlgorithmParameterSpec!: the algorithm parameters. |
Exceptions | |
---|---|
java.security.InvalidKeyException |
if the given key is inappropriate for initializing this MAC. |
java.security.InvalidAlgorithmParameterException |
if the given algorithm parameters are inappropriate for this MAC. |
engineReset
protected abstract fun engineReset(): Unit
Resets the MAC for further use, maintaining the secret key that the MAC was initialized with.
engineUpdate
protected abstract fun engineUpdate(input: Byte): Unit
Processes the given byte.
Parameters | |
---|---|
input |
Byte: the input byte to be processed. |
engineUpdate
protected abstract fun engineUpdate(
input: ByteArray!,
offset: Int,
len: Int
): Unit
Processes the first len
bytes in input
, starting at offset
inclusive.
Parameters | |
---|---|
input |
ByteArray!: the input buffer. |
offset |
Int: the offset in input where the input starts. |
len |
Int: the number of bytes to process. |
engineUpdate
protected open fun engineUpdate(input: ByteBuffer!): Unit
Processes input.remaining()
bytes in the ByteBuffer input
, starting at input.position()
. Upon return, the buffer's position will be equal to its limit; its limit will not have changed.
Subclasses should consider overriding this method if they can process ByteBuffers more efficiently than byte arrays.
Parameters | |
---|---|
input |
ByteBuffer!: the ByteBuffer |