generate

Generates a new PrivateKey using CryptoRand.Default as the source for procuring cryptographically secure random data.

Throws

if procurement of cryptographically secure random data fails


@JvmStatic
@JvmOverloads
fun generate(seed: ByteArray, offset: Int, clear: Boolean = true): X25519.PrivateKey(source)

Generates a new PrivateKey using 32-bytes from provided seed, starting at index offset.

Parameters

seed

32-byte (minimum) array

offset

the index (inclusive) to start at when copying bytes from seed

clear

if true, seed indices from offset to offset + 32 (exclusive) will be set to 0

Throws

IndexOutOfBoundsException

if seed and/or offset are inappropriate sizes

if generated key fail checksum validation, or seed indices are all 0 bytes