Ed25519

Implementation of the KeyGenerator and Signer interfaces, specifically utilizing the Ed25519 elliptic curve digital signature algorithm. This implementation provides functionality to generate key pairs, compute public keys from private keys, and sign/verify messages utilizing Ed25519.

Example Usage:

TODO: Insert example usage here.

Properties

Link copied to clipboard
open override val algorithm: Jwa

Specifies the JWS algorithm type. For Ed25519, this is EdDSA.

Link copied to clipboard
open override val curve: JwaCurve

The curve used for the key generation.

Link copied to clipboard
open override val keyType: String

KeyType in String format (OKP, EC, etc.).

Link copied to clipboard
const val PRIV_MULTICODEC: Int = 4864

A byte array representing the multicodec prefix for an Ed25519 private key.

Link copied to clipboard
const val PUB_MULTICODEC: Int = 237

A byte array representing the multicodec prefix for an Ed25519 public key.

Functions

Link copied to clipboard
open override fun bytesToPrivateKey(privateKeyBytes: ByteArray): Jwk

Converts a private key as bytes into a Jwk.

Link copied to clipboard
open override fun bytesToPublicKey(publicKeyBytes: ByteArray): Jwk

Converts a public key as bytes into a Jwk. Applicable for asymmetric Key Generators only. Implementers of symmetric key generators should throw an UnsupportedOperation Exception

Link copied to clipboard
open override fun computePublicKey(privateKey: Jwk): Jwk

Derives the public key corresponding to a given private key.

Link copied to clipboard
open override fun generatePrivateKey(options: KeyGenOptions?): Jwk

Generates a private key utilizing the Ed25519 algorithm.

Link copied to clipboard
open override fun privateKeyToBytes(privateKey: Jwk): ByteArray

Converts a private key to bytes.

Link copied to clipboard
open override fun publicKeyToBytes(publicKey: Jwk): ByteArray

Converts a public key to bytes. Applicable for asymmetric KeyGenerator implementations only. Implementers of symmetric key generators should throw an UnsupportedOperation Exception

Link copied to clipboard
open override fun sign(privateKey: Jwk, payload: ByteArray, options: SignOptions?): ByteArray

Sign a given payload using a private key.

Link copied to clipboard

Validates the provided Jwk (JSON Web Key) to ensure it conforms to the expected key type and format.

Link copied to clipboard

Validates the provided Jwk (JSON Web Key) is a public key

Link copied to clipboard
open override fun verify(publicKey: Jwk, signedPayload: ByteArray, signature: ByteArray, options: VerifyOptions?)

Verify the signature of a given payload using a public key.