Class AESEncryptionBackend
java.lang.Object
com.atlassian.secrets.service.aes.AESEncryptionBackend
- All Implemented Interfaces:
SecretServiceBackend
This class, AESInPlaceEncryptionService, implements the SecretService interface and provides methods for sealing (encrypting)
and unsealing (decrypting) secrets using the
It uses a
The seal method takes an identifier and a plaintext string, encrypts the plaintext using the AES algorithm and a generated IV, and returns the encrypted text as a Base64-encoded string.
The unseal method takes a secured value (an encrypted, Base64-encoded string), decodes the IV and the string from base64 encoding, decrypts it using the AES algorithm and the IV that was used for encryption, and returns the original plaintext string.
The class also provides a static method for generating a default key, which can be used for testing purposes.
AES/GCM/NoPadding algorithm.
It uses a
SecretKey for encryption and decryption, and a Cipher for the actual encrypting and decrypting operations.
The class also uses a AESEncryptionBackend.GeneratedIv functional interface to generate an initialization vector (IV) for the
AES algorithm.
The seal method takes an identifier and a plaintext string, encrypts the plaintext using the AES algorithm and a generated IV, and returns the encrypted text as a Base64-encoded string.
The unseal method takes a secured value (an encrypted, Base64-encoded string), decodes the IV and the string from base64 encoding, decrypts it using the AES algorithm and the IV that was used for encryption, and returns the original plaintext string.
The class also provides a static method for generating a default key, which can be used for testing purposes.
- Since:
- 5.0.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected static byte[]getType()unseal(SealedSecret sealedSecret)
-
Field Details
-
AES_ALGORITHM
- See Also:
-
ALGORITHM_SPECIFICATION
- See Also:
-
IV_LENGTH
public static final int IV_LENGTH- See Also:
-
MAX_AES_KEY_SIZE
public static final int MAX_AES_KEY_SIZE- See Also:
-
TAG_LENGTH
public static final int TAG_LENGTH- See Also:
-
backendId
-
-
Constructor Details
-
AESEncryptionBackend
- Throws:
SecretServiceException
-
-
Method Details
-
seal
- Specified by:
sealin interfaceSecretServiceBackend- Throws:
SecretServiceException
-
unseal
- Specified by:
unsealin interfaceSecretServiceBackend- Throws:
SecretServiceException
-
delete
- Specified by:
deletein interfaceSecretServiceBackend- Throws:
SecretServiceException
-
getType
- Specified by:
getTypein interfaceSecretServiceBackend
-
generateIV
protected static byte[] generateIV()
-