In Memory Key Manager
A class for managing cryptographic keys in-memory.
InMemoryKeyManager
is an implementation of KeyManager that stores keys in-memory using a mutable map. It provides methods to:
Generate private keys (generatePrivateKey)
Retrieve public keys (getPublicKey)
Sign payloads (sign)
Example Usage:
val keyManager = InMemoryKeyManager()
val keyID = keyManager.generatePrivateKey(JWSAlgorithm.EdDSA, Curve.Ed25519)
val publicKey = keyManager.getPublicKey(keyID)
Notes:
Keys are stored in an in-memory mutable map and will be lost once the application is terminated or the object is garbage-collected.
It is suitable for testing or scenarios where persistent storage of keys is not necessary.
Functions
Generates a private key using specified algorithmId, and stores it in the in-memory keyStore.
Return the alias of publicKey, as was originally returned by generatePrivateKey.
Computes and returns a public key corresponding to the private key identified by the provided keyAlias.