Mac

expect abstract class Mac : Algorithm, Copyable<Mac> , Resettable, Updatable(source)

Core abstraction for Message Authentication Code implementations.

A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret (key). Typically, message authentication codes are used between two parties that share a secret (key) in order to validate information transmitted between these parties.

Implementations of Mac should follow the Java naming guidelines for algorithm which can be found at:

https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#mac-algorithms

See also

actual abstract class Mac : Mac, Algorithm, Copyable<Mac> , Resettable, Updatable(source)

Core abstraction for Message Authentication Code implementations. Extends Java's javax.crypto.Mac for compatibility.

A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret (key). Typically, message authentication codes are used between two parties that share a secret (key) in order to validate information transmitted between these parties.

Implementations of Mac should follow the Java naming guidelines for algorithm which can be found at:

https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#mac-algorithms

See also

Throws

IllegalArgumentException

if algorithm is blank

actual abstract class Mac : Algorithm, Copyable<Mac> , Resettable, Updatable(source)

Core abstraction for Message Authentication Code implementations.

A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret (key). Typically, message authentication codes are used between two parties that share a secret (key) in order to validate information transmitted between these parties.

Implementations of Mac should follow the Java naming guidelines for algorithm which can be found at:

https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#mac-algorithms

See also

Throws

IllegalArgumentException

if algorithm is blank

Constructors

Link copied to clipboard
protected expect constructor(algorithm: String, engine: Mac.Engine)

Creates a new Mac for the specified parameters.

protected expect constructor(other: Mac)

Creates a new Mac from other, copying its Engine and state.

protected actual constructor(algorithm: String, engine: Mac.Engine)

Creates a new Mac for the specified parameters.

protected actual constructor(other: Mac)

Creates a new Mac from other, copying its Engine and state.

protected actual constructor(algorithm: String, engine: Mac.Engine)

Creates a new Mac for the specified parameters.

protected actual constructor(other: Mac)

Creates a new Mac from other, copying its Engine and state.

Types

Link copied to clipboard
protected expect abstract class Engine : Copyable<Mac.Engine> , Resettable, Updatable

Core abstraction for powering a Mac implementation.

protected actual abstract class Engine : MacSpi, Cloneable, Copyable<Mac.Engine> , Resettable, Updatable

Core abstraction for powering a Mac implementation. Extends Java's MacSpi for compatibility.

protected actual abstract class Engine : Copyable<Mac.Engine> , Resettable, Updatable

Core abstraction for powering a Mac implementation.

Functions

Link copied to clipboard
expect override fun algorithm(): String
actual override fun algorithm(): String
actual override fun algorithm(): String
Link copied to clipboard
expect fun clearKey()

Helper function that will call reset with a blank key in order to zero it out.

actual fun clearKey()

Helper function that will call reset with a blank key in order to zero it out.

actual fun clearKey()

Helper function that will call reset with a blank key in order to zero it out.

Link copied to clipboard
expect fun doFinal(): ByteArray

Completes the computation, performing final operations and returning the resultant array of bytes. The Mac is reset afterward.

expect fun doFinal(input: ByteArray): ByteArray

Updates the instance with provided input then completes the computation, performing final operations and returning the resultant array of bytes. The Mac is reset afterward.

actual fun doFinal(): ByteArray

Completes the computation, performing final operations and returning the resultant array of bytes. The Mac is reset afterward.

actual fun doFinal(input: ByteArray): ByteArray

Updates the instance with provided input then completes the computation, performing final operations and returning the resultant array of bytes. The Mac is reset afterward.

Link copied to clipboard
expect fun doFinalInto(dest: ByteArray, destOffset: Int): Int

Completes the computation, performing final operations and placing the resultant bytes into the provided dest array starting at index destOffset. The Mac is reset afterward.

actual fun doFinalInto(dest: ByteArray, destOffset: Int): Int

Completes the computation, performing final operations and placing the resultant bytes into the provided dest array starting at index destOffset. The Mac is reset afterward.

actual fun doFinalInto(dest: ByteArray, destOffset: Int): Int

Completes the computation, performing final operations and placing the resultant bytes into the provided dest array starting at index destOffset. The Mac is reset afterward.

Link copied to clipboard
expect fun macLength(): Int

The number of bytes the implementation returns when doFinal is called.

actual fun macLength(): Int

The number of bytes the implementation returns when doFinal is called.

actual fun macLength(): Int

The number of bytes the implementation returns when doFinal is called.

Link copied to clipboard
expect override fun reset()

expect fun reset(newKey: ByteArray)

Resets the Mac and will reinitialize it with the provided key.

actual fun reset(newKey: ByteArray)

Resets the Mac and will reinitialize it with the provided key.

actual override fun reset()

actual fun reset(newKey: ByteArray)

Resets the Mac and will reinitialize it with the provided key.

Link copied to clipboard
expect override fun update(input: Byte)
expect override fun update(input: ByteArray)
expect override fun update(input: ByteArray, offset: Int, len: Int)
actual override fun update(input: Byte)
actual override fun update(input: ByteArray)
actual override fun update(input: ByteArray, offset: Int, len: Int)