PrivateKey

A 32 byte x25519 private key.

This would be the key added to a tor client by a user who wishes to connect to a Hidden Service that has been configured using the X25519.PublicKey associated with this X25519.PrivateKey.

See also

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun algorithm(): String

x25519

Link copied to clipboard
expect fun base16(): String

Returns a Base16 (uppercase) encoded String of the raw key value.

Link copied to clipboard
expect fun base16Chars(): CharArray

Returns a Base16 (uppercase) encoded CharArray of the raw key value.

Link copied to clipboard
expect override fun base16CharsOrNull(): CharArray?

Returns a Base16 (uppercase) encoded CharArray of the raw key value, or null if the key does not support encoding or Key.Private.isDestroyed is true.

Link copied to clipboard
expect override fun base16OrNull(): String?

Returns a Base16 (uppercase) encoded String of the raw key value, or null if the key does not support encoding or Key.Private.isDestroyed is true.

Link copied to clipboard
expect fun base32(): String

Returns a Base32 (uppercase & no padding) encoded String of the raw key value.

Link copied to clipboard
expect fun base32Chars(): CharArray

Returns a Base32 (uppercase & no padding) encoded CharArray of the raw key value.

Link copied to clipboard
expect override fun base32CharsOrNull(): CharArray?

Returns a Base32 (uppercase & no padding) encoded CharArray of the raw key value, or null if the key does not support encoding or Key.Private.isDestroyed is true.

Link copied to clipboard
expect override fun base32OrNull(): String?

Returns a Base32 (uppercase & no padding) encoded String of the raw key value, or null if the key does not support encoding or Key.Private.isDestroyed is true.

Link copied to clipboard
expect fun base64(): String

Returns a Base64 (no padding) encoded String of the raw key value.

Link copied to clipboard
expect fun base64Chars(): CharArray

Returns a Base64 (no padding) encoded CharArray of the raw key value.

Link copied to clipboard
expect override fun base64CharsOrNull(): CharArray?

Returns a Base64 (no padding) encoded CharArray of the raw key value, or null if the key does not support encoding or Key.Private.isDestroyed is true.

Link copied to clipboard
expect override fun base64OrNull(): String?

Returns a Base64 (no padding) encoded String of the raw key value, or null if the key does not support encoding or Key.Private.isDestroyed is true.

Link copied to clipboard

Checks if a Destroyable instance has been destroyed or not.

Link copied to clipboard
fun descriptorBase32(publicKey: AddressKey.Public): String
fun descriptorBase32(address: OnionAddress): String

Produces the descriptor String using the Base32 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base32 encoded key}.

Link copied to clipboard
fun descriptorBase32OrNull(publicKey: AddressKey.Public): String?

Produces the descriptor String using the Base32 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base32 encoded key}, or null if either the publicKey is not compatible with this algorithm, or isDestroyed is true.

fun descriptorBase32OrNull(address: OnionAddress): String?

Produces the descriptor String using the Base32 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base32 encoded key}, or null if either the address is not compatible with this algorithm, or isDestroyed is true.

Link copied to clipboard
fun descriptorBase32Utf8(publicKey: AddressKey.Public): ByteArray
fun descriptorBase32Utf8(address: OnionAddress): ByteArray

Produces the descriptor using the Base32 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base32 encoded key} as UTF-8 bytes.

Link copied to clipboard
fun descriptorBase32Utf8OrNull(publicKey: AddressKey.Public): ByteArray?

Produces the descriptor using the Base32 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base32 encoded key} as UTF-8 bytes, or null if either the publicKey is not compatible with this algorithm, or isDestroyed is true.

fun descriptorBase32Utf8OrNull(address: OnionAddress): ByteArray?

Produces the descriptor using the Base32 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base32 encoded key} as UTF-8 bytes, or null if either the address is not compatible with this algorithm, or isDestroyed is true.

Link copied to clipboard
fun descriptorBase64(publicKey: AddressKey.Public): String
fun descriptorBase64(address: OnionAddress): String

Produces the descriptor String using the Base64 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base64 encoded key}.

Link copied to clipboard
fun descriptorBase64OrNull(publicKey: AddressKey.Public): String?

Produces the descriptor String using the Base64 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base64 encoded key}, or null if either the publicKey is not compatible with this algorithm, or isDestroyed is true.

fun descriptorBase64OrNull(address: OnionAddress): String?

Produces the descriptor String using the Base64 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base64 encoded key}, or null if either the address is not compatible with this algorithm, or isDestroyed is true.

Link copied to clipboard
fun descriptorBase64Utf8(publicKey: AddressKey.Public): ByteArray
fun descriptorBase64Utf8(address: OnionAddress): ByteArray

Produces the descriptor using the Base64 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base64 encoded key} as UTF-8 bytes.

Link copied to clipboard
fun descriptorBase64Utf8OrNull(publicKey: AddressKey.Public): ByteArray?

Produces the descriptor using the Base64 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base64 encoded key} as UTF-8 bytes, or null if either the publicKey is not compatible with this algorithm, or isDestroyed is true.

fun descriptorBase64Utf8OrNull(address: OnionAddress): ByteArray?

Produces the descriptor using the Base64 encoding of the key in the form of {onion address without .onion}:descriptor:{algorithm}:{base64 encoded key} as UTF-8 bytes, or null if either the address is not compatible with this algorithm, or isDestroyed is true.

Link copied to clipboard
expect override fun destroy()

Destroys the Key.Private, back-filling the underlying array with 0 bytes.

Link copied to clipboard
@JvmStatic
@JvmOverloads
fun Destroyable.destroyedException(namePrefix: String = ""): IllegalStateException

Creates an IllegalStateException with a default message of

Link copied to clipboard
expect fun encoded(): ByteArray

Returns the key in its primary encoding.

Link copied to clipboard
expect override fun encodedOrNull(): ByteArray?

Returns the key in its primary encoding, or null if the key does not support encoding or Key.Private.isDestroyed is true.

Link copied to clipboard

Generates the PublicKey associated with this PrivateKey.

Link copied to clipboard
expect override fun isDestroyed(): Boolean