generateKeyPair

Generates a new ed25519 key pair, suitable for use with tor hidden services. Utilizes CryptoRand.Default as the source for procuring cryptographically secure random data.

Throws

if procurement of cryptographically secure random data fails


@JvmStatic
@JvmOverloads
fun generateKeyPair(seed: ByteArray, offset: Int, clear: Boolean = true): Pair<ED25519_V3.PublicKey, ED25519_V3.PrivateKey>(source)

Generates a new ed25519 key pair, suitable for use with tor hidden services. Utilizes 32-bytes from provided seed, starting at index offset.

Parameters

seed

32-byte (minimum) array to use for generating the PrivateKey

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 keys fail checksum validation, or seed indices are all 0 bytes