Companion
Companion object for the Aes256GCMEncryptor class. Provides utility methods for managing AES-256-GCM encryption keys, including generation, serialization, and deserialization.
Features:
Generates a random AES-256 key securely using a cryptographically strong random number generator.
Converts a Base64-encoded string back to a SecretKey, ensuring the key format and size are valid.
Serializes a SecretKey to a Base64-encoded string for easy storage and transport.
Functions
Generates a random secret key to be used for encryption purposes. The method relies on a cryptographic key generator to create a secure key.
Converts a base64-encoded string representation of a secret key into a SecretKey
object. The input string must represent a valid AES-256 key (32 bytes long after decoding).
Converts the provided secret key into its Base64-encoded string representation. This method is useful for securely exporting or storing the key as a string.