Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// GetGroup retrieves a BackendGroup by its name with the specified options, creating it if AutoCreate is true in options.
GetGroup(name string, opts GroupOptions) (BackendGroup, error)
}
Backend defines an interface for managing and retrieving signing key groups. It provides methods for accessing or creating grouped keys used in cryptographic operations.
type BackendConfig ¶
type BackendConfig interface {
// Create initializes and returns a new Backend instance or an error if the creation fails.
Create() (Backend, error)
}
BackendConfig defines an interface for creating a cryptographic backend that manages signing key groups.
type BackendGroup ¶
type BackendGroup interface {
// GetKey retrieves the active signing key for the specified JWA algorithm or generates a new one if none exists.
GetKey(jwa string) (SigningKey, error)
}
BackendGroup provides an interface for managing and retrieving cryptographic signing keys grouped by algorithm names. It includes methods to retrieve or generate the appropriate signing key for a given algorithm.
type Config ¶
type Config struct {
// Backend specifies the configuration for initializing and managing a cryptographic backend.
Backend BackendConfig
}
Config holds the configuration settings for initializing a cryptographic backend.
type GroupOption ¶
type GroupOption func(*GroupOptions)
GroupOption defines a function type used to configure GroupOptions for customizing group behaviors.
type GroupOptions ¶
type GroupOptions struct {
}
GroupOptions provides configuration options for managing groups, such as enabling automatic creation of missing groups.
type KeyGroup ¶
type KeyGroup interface {
// GetKey retrieves the signing key corresponding to the specified JSON Web Algorithm (JWA).
GetKey(jwa string) (SigningKey, error)
}
KeyGroup defines an interface for retrieving signing keys based on a specified JSON Web Algorithm (JWA).
type KeyManager ¶
type KeyManager interface {
// GetGroup retrieves a KeyGroup by its name, with optional configurations applied through variadic GroupOption parameters.
GetGroup(name string, opts ...GroupOption) KeyGroup
}
KeyManager defines an interface for managing cryptographic key groups used in signing and verification operations. GetGroup provides access to a KeyGroup by name, allowing optional configurations through GroupOptions parameters.
func New ¶
func New(cfg Config) (KeyManager, error)
New initializes and returns a KeyManager instance configured with the provided backend, or an error if creation fails.
type SigningKey ¶
type SigningKey interface {
// Sign generates a digital signature for the provided data using the private key associated with the SigningKey.
Sign(data []byte) ([]byte, error)
// Verify checks if the provided signature is valid for the given data using the public key.
Verify(data, signature []byte) error
// PublicKey retrieves the public key associated with the SigningKey for verification or distribution purposes.
PublicKey() (crypto.PublicKey, error)
// Algorithm returns the name of the cryptographic algorithm associated with the key, e.g., "RS256".
Algorithm() string
// KeyID returns a unique identifier for this signing key, used to differentiate it from other keys.
KeyID() string
}
SigningKey represents an interface for cryptographic signing operations and metadata retrieval.