public interface AuthenticatedEncryption
See: https://en.wikipedia.org/wiki/Authenticated_encryption
| Modifier and Type | Interface and Description |
|---|---|
static interface |
AuthenticatedEncryption.KeyStrength |
| Modifier and Type | Field and Description |
|---|---|
static int |
STRENGTH_HIGH
High Security which is equivalent to a AES key size of 128 bit
|
static int |
STRENGTH_VERY_HIGH
Very high security which is equivalent to a AES key size of 256 bit
Note: This is usually not required.
|
| Modifier and Type | Method and Description |
|---|---|
int |
byteSizeLength(int keyStrengthType)
Get the required key size length in bytes for given security strength type
|
byte[] |
decrypt(byte[] rawEncryptionKey,
byte[] encryptedData,
byte[] associatedData)
Decrypt and verifies the authenticity of given encrypted data
|
byte[] |
encrypt(byte[] rawEncryptionKey,
byte[] rawData,
byte[] associatedData)
Encrypts and adds a authentication tag the given content
|
static final int STRENGTH_HIGH
static final int STRENGTH_VERY_HIGH
byte[] encrypt(byte[] rawEncryptionKey,
byte[] rawData,
byte[] associatedData)
throws AuthenticatedEncryptionException
rawEncryptionKey - to use as encryption key materialrawData - to encryptassociatedData - additional data used to create the auth tag and will be subject to integrity/authentication checkAuthenticatedEncryptionException - if any crypto failsbyte[] decrypt(byte[] rawEncryptionKey,
byte[] encryptedData,
byte[] associatedData)
throws AuthenticatedEncryptionException
rawEncryptionKey - to use as decryption key materialencryptedData - to decryptassociatedData - additional data used to create the auth tag; must be same as provided
in the encrypt stepAuthenticatedEncryptionException - if any crypto failsint byteSizeLength(int keyStrengthType)
keyStrengthType - STRENGTH_HIGH or STRENGTH_VERY_HIGH