tuweni / org.apache.tuweni.crypto.sodium / XChaCha20Poly1305 / Key

Key

class Key : Destroyable (source)

A XChaCha20-Poly1305 key.

Functions

bytes

fun bytes(): Bytes

Obtain the bytes of this key. WARNING: This will cause the key to be copied into heap memory.

bytesArray

fun bytesArray(): ByteArray

Obtain the bytes of this key. WARNING: This will cause the key to be copied into heap memory. The returned array should be overwritten when no longer required.

destroy

fun destroy(): Unit

equals

fun equals(other: Any?): Boolean

fromBytes

static fun fromBytes(bytes: Bytes): Key
static fun fromBytes(bytes: ByteArray): Key

Create a Key from an array of bytes.

The byte array must be of length #length().

hashCode

fun hashCode(): Int

isDestroyed

fun isDestroyed(): Boolean

length

static fun length(): Int

Obtain the length of the key in bytes (32).

random

static fun random(): Key

Generate a new key using a random generator.