pki.util.keys¶
Utility methods for private key generation and hash algorithm retrieval.
Classes¶
The key algorithms supported by the AutoGenPKI. |
|
Utility class for generating private keys. |
|
Utilities methods for cryptography corresponding to Trustpoint models. |
Functions¶
|
TypeGuard function that narrows down the public key type. |
Module Contents¶
- class pki.util.keys.AutoGenPkiKeyAlgorithm(*args, **kwds)[source]¶
Bases:
django.db.models.TextChoicesThe key algorithms supported by the AutoGenPKI.
- class pki.util.keys.KeyGenerator[source]¶
Utility class for generating private keys.
- static generate_private_key_for_public_key_info(key_info)[source]¶
Generates a private key for a public key info.
- Returns:
The generated private key.
- Parameters:
key_info (trustpoint_core.oid.PublicKeyInfo)
- Return type:
trustpoint_core.crypto_types.PrivateKey
- static generate_private_key(domain)[source]¶
Generates a key pair of the type corresponding to the domain model.
- Parameters:
domain (pki.models.domain.DomainModel) – The domain to consider.
- Returns:
The generated private key / key pair serializer.
- Return type:
trustpoint_core.serializer.PrivateKeySerializer
- class pki.util.keys.CryptographyUtils[source]¶
Utilities methods for cryptography corresponding to Trustpoint models.
- static get_hash_algorithm_for_private_key(private_key)[source]¶
Gets a suitable hash algorithm for a given private key.
- Parameters:
private_key (trustpoint_core.crypto_types.PrivateKey) – The private key to consider.
- Returns:
The hash algorithm to use.
- Return type:
cryptography.hazmat.primitives.hashes.HashAlgorithm
- pki.util.keys.is_supported_public_key(public_key)[source]¶
TypeGuard function that narrows down the public key type.
- Parameters:
public_key (Any) – The loaded public key to check if it is supported.
- Returns:
True if it is supported, False otherwise.
- Return type:
TypeGuard[trustpoint_core.crypto_types.PublicKey]