management.management.commands.unwrap_dek¶
Management command to test KEK loading and DEK unwrapping for PKCS11Token.
- Usage:
python manage.py unwrap_dek [–token-label <label>]
Attributes¶
Classes¶
A Django management command to test KEK loading and DEK unwrapping for PKCS11Token. |
Module Contents¶
- class management.management.commands.unwrap_dek.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
django.core.management.base.BaseCommand,trustpoint.logger.LoggerMixinA Django management command to test KEK loading and DEK unwrapping for PKCS11Token.
This command allows testing of Key Encryption Key (KEK) loading and Data Encryption Key (DEK) unwrapping for a specified PKCS11 token. It supports specifying a token label or defaults to the first available token.
- add_arguments(parser)[source]¶
Add command-line arguments to the parser.
- Parameters:
parser (ArgumentParser) – The argument parser instance to which arguments are added.
- Return type:
None
- handle(*args, **options)[source]¶
Handle the management command execution.
This method retrieves the specified PKCS11 token (or the first available one), tests the Key Encryption Key (KEK) loading, and attempts to unwrap the Data Encryption Key (DEK).
- Parameters:
*args (str) – Positional arguments passed to the command.
**options (dict) – Keyword arguments passed to the command, including ‘token_label’.
Raises
------
Exception – If any error occurs during KEK loading or DEK unwrapping.
- Return type:
None
- log_and_stdout(message, level='info')[source]¶
Log a message and write it to stdout.
- Parameters:
message (str) – The message to log and print.
level (str) – The logging level (‘info’, ‘warning’, ‘error’, etc.).
- Return type:
None
- _test_kek_loading(token)[source]¶
Test loading the KEK (Key Encryption Key).
- Parameters:
token (management.models.PKCS11Token)
- Return type:
None
- _test_dek_unwrapping(token)[source]¶
Test unwrapping the DEK.
- Parameters:
token (management.models.PKCS11Token)
- Return type:
None