Class AESKeyGenerator
java.lang.Object
com.atlassian.secrets.service.aes.AESKeyGenerator
This class is responsible for generating a 256-bit AES key and writing it to a file.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor that uses system UTC clock and UUID entropy for filenameAESKeyGenerator(Clock clock, Supplier<String> filenameEntropySupplier) Constructor for testing purposes. -
Method Summary
Modifier and TypeMethodDescriptiongenerateDefaultKey(Path secretKeyDirectory) Generates a default key and writes it to the specified directory.static StringGenerates a random UUID string for entropy.
-
Constructor Details
-
AESKeyGenerator
public AESKeyGenerator()Default constructor that uses system UTC clock and UUID entropy for filename -
AESKeyGenerator
Constructor for testing purposes.- Parameters:
clock- Clock instance to use.filenameEntropySupplier- Supplier for entropy.
-
-
Method Details
-
generateDefaultKey
Generates a default key and writes it to the specified directory. The key filename will be in the format: AES256_YYYY-MM-DD-HHmmss_UUID For example: AES256_2024-03-19-213347_afa7684f-ac0a-4873-b216-d1527841ca72- Parameters:
secretKeyDirectory- Directory to write the key to.- Returns:
- Path to the generated key.
-
getUUIDFilenameEntropy
Generates a random UUID string for entropy.- Returns:
- The generated UUID string.
-