KeyManager

interface KeyManager

A key management interface that provides functionality for generating, storing, and utilizing private keys and their associated public keys. Implementations of this interface should handle the secure generation and storage of keys, providing mechanisms for utilizing them in cryptographic operations like signing.

Example implementations might provide key management through various Key Management Systems (KMS), such as AWS KMS, Google Cloud KMS, Hardware Security Modules (HSM), or simple in-memory storage, each adhering to the same consistent API for usage within applications.

Inheritors

Functions

Link copied to clipboard
abstract fun generatePrivateKey(algorithmId: AlgorithmId, options: KeyGenOptions? = null): String

Generates and securely stores a private key based on the provided algorithm and options, returning a unique alias that can be utilized to reference the generated key for future operations.

Link copied to clipboard
abstract fun getDeterministicAlias(publicKey: Jwk): String

Return the alias of publicKey, as was originally returned by generatePrivateKey.

Link copied to clipboard
abstract fun getPublicKey(keyAlias: String): Jwk

Retrieves the public key associated with a previously stored private key, identified by the provided alias.

Link copied to clipboard
abstract fun sign(keyAlias: String, signingInput: ByteArray): ByteArray

Signs the provided payload using the private key identified by the provided alias.