Replies: 1 comment
-
Interface plantype ConfigCryptoProvider interface {
Encrypt(ctx context.Context, content []byte) ([]byte, error)
Decrypt(ctx context.Context, content []byte) ([]byte, error)
}
type RuntimeCryptoProvider interface {
Encrypt(ctx context.Context, keyRef KeyRef, algorithm Algorithm, content []byte) ([]byte, error)
Decrypt(ctx context.Context, keyRef KeyRef, algorithm Algorithm, content []byte) ([]byte, error)
Sign(ctx context.Context, keyRef KeyRef, algorithm Algorithm, content []byte) ([]byte, error)
GetPublicKeys(ctx context.Context, filter PublicKeyFilter) ([]PublicKeyInfo, error)
GetTLSMaterial(ctx context.Context, keyRef KeyRef) (*TLSMaterial, error)
}Method DescriptionsConfigCryptoProvider
RuntimeCryptoProvider
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Related Feature Issue
#2047
Problem Summary
The server currently lacks a unified abstraction for cryptographic operations, with different components directly using file-based PKI logic or isolated helpers. This results in tight coupling to a single backend, inconsistent crypto behavior, and duplicated implementations across features. As a result, integrating alternative key management solutions or evolving key handling becomes complex and error-prone.
Derived from : #2253
High-Level Approach
Introduce a dedicated
keystorepackage as the central abstraction for all cryptographic operationsDefine separate interfaces for:
ConfigCryptoProvider)RuntimeCryptoProvider)Implement an initial provider that wraps existing file-based PKI and encryption logic (no behavior change)
Gradually migrate existing components:
Enable pluggable provider architecture to support future backends (e.g., remote KMS, HSM) without modifying feature code
Architecture Overview
ConfigCryptoProviderandRuntimeCryptoProvideras core interfacesSecurity Considerations
keystoreboundary so key usage becomes more consistent and easier to reviewImpacted Areas
Alternatives Considered
Multiple different designs for the interface. Considering the pluggability and clear separation of config time and run time crypto operations, we will proceed with the following interface.
Questions for Community Input
Decrypt()accept akidso the backend can find the right key for old data?KID support for decryption?Beta Was this translation helpful? Give feedback.
All reactions