tuweni / org.apache.tuweni.crypto.sodium / KeyDerivation / MasterKey

MasterKey

class MasterKey : Destroyable (source)

A KeyDerivation master key.

Functions

bytes

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

fun bytes(): Bytes!

bytesArray

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.

fun bytesArray(): ByteArray!

deriveKey

Derive a sub key.

fun deriveKey(length: Int, subkeyId: Long, context: ByteArray!): Bytes!
fun deriveKey(length: Int, subkeyId: Long, context: String!): Bytes!

deriveKeyArray

Derive a sub key.

fun deriveKeyArray(length: Int, subkeyId: Long, context: ByteArray!): ByteArray!
fun deriveKeyArray(length: Int, subkeyId: Long, context: String!): ByteArray!

destroy

fun destroy(): Unit

equals

fun equals(other: Any?): Boolean

fromBytes

Create a MasterKey from an array of bytes.

static fun fromBytes(bytes: Bytes!): MasterKey!
static fun fromBytes(bytes: ByteArray!): MasterKey!

hashCode

fun hashCode(): Int

isDestroyed

fun isDestroyed(): Boolean

length

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

static fun length(): Int

random

Generate a new key using a random generator.

static fun random(): MasterKey!