Auth

actual object Auth
expect object Auth

Authentication is a process of generating authentication data (tag) for a certain message. Its purpose is to assure that the data hasn't been corrupted or tampered with during the transport.

We support 3 variants:

  • without suffix - HMAC-SHA512-256 (HMAC SHA512 with just the first 256 bits used)

  • *HmacSha256 - HMAC-SHA256

  • *HmacSha512 - HMAC-SHA512

Each variant supports three operations:

  • keygen - generate appropriate key for MAC function

  • auth - generate the authentication data (tag/mac)

  • verify - verify that the authenticatoin data (tag/mac) is correct

actual object Auth
actual object Auth

Functions

Link copied to clipboard
actual fun auth(message: UByteArray, key: UByteArray): UByteArray
expect fun auth(message: UByteArray, key: UByteArray): UByteArray

Generate a HMAC-SHA512-256 authentication data - Message Authentication Code - tag

actual fun auth(message: UByteArray, key: UByteArray): UByteArray
actual fun auth(message: UByteArray, key: UByteArray): UByteArray
Link copied to clipboard
actual fun authHmacSha256(message: UByteArray, key: UByteArray): UByteArray
expect fun authHmacSha256(message: UByteArray, key: UByteArray): UByteArray

Generate a HMAC-SHA256 authentication data - Message Authentication Code - tag

actual fun authHmacSha256(message: UByteArray, key: UByteArray): UByteArray
actual fun authHmacSha256(message: UByteArray, key: UByteArray): UByteArray
Link copied to clipboard

Generate a secret key, meant to be used with auth function.

Link copied to clipboard
actual fun authHmacSha256Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
expect fun authHmacSha256Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean

Verify that given message, secret key and tag, a newly calculated tag matches the received HMAC-SHA256 tag.

actual fun authHmacSha256Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
actual fun authHmacSha256Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
Link copied to clipboard
actual fun authHmacSha512(message: UByteArray, key: UByteArray): UByteArray
expect fun authHmacSha512(message: UByteArray, key: UByteArray): UByteArray

Generate a HMAC-SHA512 authentication data - Message Authentication Code - tag

actual fun authHmacSha512(message: UByteArray, key: UByteArray): UByteArray
actual fun authHmacSha512(message: UByteArray, key: UByteArray): UByteArray
Link copied to clipboard

Generate a secret key, meant to be used with auth function.

Link copied to clipboard
actual fun authHmacSha512Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
expect fun authHmacSha512Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean

Verify that given message, secret key and tag, a newly calculated tag matches the received HMAC-SHA512 tag.

actual fun authHmacSha512Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
actual fun authHmacSha512Verify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
Link copied to clipboard
actual fun authKeygen(): UByteArray
expect fun authKeygen(): UByteArray

Generate a secret key, meant to be used with auth function.

actual fun authKeygen(): UByteArray
actual fun authKeygen(): UByteArray
Link copied to clipboard
actual fun authVerify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
expect fun authVerify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean

Verify that given message, secret key and tag, a newly calculated tag matches the received HMAC-SHA512-256 tag.

actual fun authVerify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean
actual fun authVerify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean