tuweni / org.apache.tuweni.crypto.sodium / DiffieHelman / Secret

Secret

class Secret : Destroyable (source)

A Diffie-Helman shared secret.

Functions

bytes

fun bytes(): Bytes

bytesArray

fun bytesArray(): ByteArray

destroy

fun destroy(): Unit

equals

fun equals(other: Any?): Boolean

forKeys

static fun forKeys(secretKey: SecretKey, publicKey: PublicKey): Secret

Compute a shared Secret from a secret key and a public key.

fromBytes

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

Create a Secret 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).