SigningKey

Represents a cryptographic key (or key pair) used for JWS signing and/or verification.

Instances are identified by a (SigningAlgorithm, optional key ID) pair captured in identifier. Depending on which key material is available, a SigningKey may be:

Complementary keys that share the same Identifier can be merged into a SigningKeyPair via mergeWith. This happens automatically when both are registered with the same co.touchlab.kjwt.model.registry.DefaultJwtProcessorRegistry.

Each subtype directly implements the appropriate processor interface (JwsSigner, JwsVerifier, or JwsProcessor) and carries the cryptographic logic for its role.

See also

Inheritors

Types

Link copied to clipboard
data class Identifier(val algorithm: SigningAlgorithm, val keyId: String?)

Identifies a SigningKey within a co.touchlab.kjwt.model.registry.DefaultJwtProcessorRegistry by algorithm and optional key ID.

Link copied to clipboard
class SigningKeyPair(val identifier: SigningKey.Identifier, val publicKey: Key, val privateKey: Key) : SigningKey, JwsProcessor

A complete key pair that holds both private and public key material, implementing JwsProcessor.

Link copied to clipboard
class SigningOnlyKey(val identifier: SigningKey.Identifier, val privateKey: Key) : SigningKey, JwsSigner

A signing-only key that holds only the private key material, implementing JwsSigner.

Link copied to clipboard
class VerifyOnlyKey(val identifier: SigningKey.Identifier, val publicKey: Key) : SigningKey, JwsVerifier

A verify-only key that holds only the public key material, implementing JwsVerifier.

Properties

Link copied to clipboard
open override val algorithm: SigningAlgorithm
Link copied to clipboard

The algorithm and key ID that identify this key within a registry.

Link copied to clipboard
open override val keyId: String?
Link copied to clipboard
abstract val privateKey: Key

The private key material used for signing; throws on subtypes that do not hold a private key.

Link copied to clipboard
abstract val publicKey: Key

The public key material used for signature verification; throws on subtypes that do not hold a public key.