Enum class CipherClass
Package: keychain.constants
Description
Cipher class.
Use cipher class to specify from which general symmetric encryption algorithm class a persona should choose a specific algorithm and parameters to use during encrypting the cleartext portion (producing ciphertext) and/or the asymmetric private key portion (producing a key lock) in hybrid encryption.
Since: v2.0
Enum Class Detail
Usage Example
from keychain.constants import CipherClass
# Select a cipher class
cipher_class = CipherClass.AES
print(f"Selected cipher class: {cipher_class}") # Outputs: 1
# Cipher class selection based on requirements
def select_cipher_class(performance_priority=False, compliance_required=False):
if compliance_required:
# AES is widely standardized and required by many compliance frameworks
return CipherClass.AES
elif performance_priority:
# AES typically has better hardware acceleration support
return CipherClass.AES
else:
# Camelia provides an alternative with similar security properties
return CipherClass.CAMELIA
selected_class = select_cipher_class(performance_priority=True)
print(f"Recommended class: {selected_class}")
# Check cipher characteristics
def get_cipher_characteristics(cipher_class):
characteristics = {
CipherClass.AES: "Widely standardized, hardware accelerated, NIST approved",
CipherClass.CAMELIA: "Alternative to AES, similar security properties"
}
return characteristics.get(cipher_class, "Unknown")
characteristics = get_cipher_characteristics(cipher_class)
print(f"Cipher characteristics: {characteristics}")
# Check if cipher class supports specific operations
def supports_hybrid_encryption(cipher_class):
# Both AES and Camelia support hybrid encryption
return cipher_class in [CipherClass.AES, CipherClass.CAMELIA]
supports_hybrid = supports_hybrid_encryption(cipher_class)
print(f"Supports hybrid encryption: {supports_hybrid}")