Enum class KeychainType
Package: keychain.constants
Description
Keychain type (encrypt or sign).
This enum specifies the type of cryptographic operations a keychain is designed for. Keychains can be specialized for either encryption operations or signing operations, each with different cryptographic requirements and use cases.
Since: v2.0
Enum Class Detail
Usage Example
from keychain.constants import KeychainType
# Create different keychain types
encryption_keychain = KeychainType.ENCRYPT
signing_keychain = KeychainType.SIGN
print(f"Encryption keychain type: {encryption_keychain}") # Outputs: 0
print(f"Signing keychain type: {signing_keychain}") # Outputs: 1
# Determine keychain purpose
def get_keychain_purpose(keychain_type):
if keychain_type == KeychainType.ENCRYPT:
return "Used for encrypting and decrypting data"
elif keychain_type == KeychainType.SIGN:
return "Used for creating and verifying digital signatures"
else:
return "Unknown keychain type"
purpose = get_keychain_purpose(encryption_keychain)
print(purpose) # Outputs: "Used for encrypting and decrypting data"