class Auth
(source)
Secret-key authentication.
These operations computes an authentication tag for a message and a secret key, and provides a way to verify that a given tag is valid for a given message and a key.
The function computing the tag is deterministic: the same (message, key) tuple will always produce the same output.
However, even if the message is public, knowing the key is required in order to be able to compute a valid tag. Therefore, the key should remain confidential. The tag, however, can be public.
A typical use case is:
A
prepares a message, add an authentication tag, sends it to B
A
doesn't store the messageB
sends the message and the authentication tag to A
A
uses the authentication tag to verify that it created this message.This operation does not encrypt the message. It only computes and verifies an authentication tag.
class Key : Destroyable
An Auth key. |
static fun auth(input: Bytes, key: Key): Bytes static fun auth(input: ByteArray, key: Key): ByteArray
Create an authentication tag for a given input. |
|
static fun verify(tag: Bytes, input: Bytes, key: Key): Boolean static fun verify(tag: ByteArray, input: ByteArray, key: Key): Boolean
Verify an input using an authentication tag. |