Class CipherText

java.lang.Object
page.codeberg.friedolyn.crypto.CipherText
All Implemented Interfaces:
Copyable<CipherText>

public class CipherText extends Object implements Copyable<CipherText>
Represents a secret message that has been encrypted using the AES algorithm in Galois/Counter Mode (GCM). The message can be decrypted again using the same human-readable password that was used to encrypt it. Of course, that password is not stored in the CipherText object but must be provided by the caller.
Implementation Note:
This class is not a record, because the constructor needs to check that the provided cipher text and initialisation vector are not null or empty and throw an IllegalArgumentException if that's the case. While that could be done in a record as well, we cannot add throws IllegalArgumentException to the record's constructor signature, risking that callers of the constructor will not handle the exception. JavaDoc is not a sufficient replacement here!