Key ring
Base key ring interface for managing multiple encryption keys.
This module provides the BaseKeyRing abstract class that defines the interface for managing multiple encryption keys and their associated encryptors.
References
NONE
BaseKeyRing
Bases: ABC
Abstract base class defining the interface for managing multiple encryption keys.
add(key_id, encryptor)
abstractmethod
Add a new key to the key ring.
This method should be implemented by subclasses to provide the adding functionality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_id |
str
|
Unique identifier for the key. |
required |
encryptor |
BaseEncryptor
|
The encryptor instance for this key. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the method is not implemented by the subclass. |
get(key_id)
abstractmethod
Get an encryptor by key ID.
This method should be implemented by subclasses to provide the getting functionality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_id |
str
|
ID of the key to retrieve. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BaseEncryptor |
BaseEncryptor
|
The encryptor for the specified key. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the method is not implemented by the subclass. |
remove(key_id)
abstractmethod
Remove a key from the key ring.
This method should be implemented by subclasses to provide the removing functionality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_id |
str
|
ID of the key to remove. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the method is not implemented by the subclass. |