Package org.signal.libsignal.crypto
Class Aes256GcmDecryption
-
- All Implemented Interfaces:
-
org.signal.libsignal.internal.NativeHandleGuard.Owner
public class Aes256GcmDecryption extends NativeHandleGuard.SimpleOwner
Implements the AES-256-GCM authenticated stream cipher with a 12-byte nonce.
This API exposes the streaming nature of AES-GCM to allow decrypting data without having it resident in memory all at once. You must call verifyTag when the decryption is complete, or else you have no authenticity guarantees.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intTAG_SIZE_IN_BYTES
-
Constructor Summary
Constructors Constructor Description Aes256GcmDecryption(Array<byte> key, Array<byte> nonce, Array<byte> associatedData)Initializes the cipher with the given inputs.
-
Method Summary
Modifier and Type Method Description voiddecrypt(Array<byte> ciphertext)Decrypts ciphertextin place and advances the state of the cipher.voiddecrypt(Array<byte> ciphertext, int offset, int length)Decrypts ciphertextin place and advances the state of the cipher.booleanverifyTag(Array<byte> tag)Returns trueif and only iftagmatches the ciphertext that has been processed.-
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.SimpleOwner
unsafeNativeHandleWithoutGuard -
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.Owner
guard, guardedMap, guardedMapChecked, guardedRun, guardedRunChecked -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
decrypt
void decrypt(Array<byte> ciphertext)
Decrypts
ciphertextin place and advances the state of the cipher.Don't forget to call verifyTag when decryption is complete.
-
decrypt
void decrypt(Array<byte> ciphertext, int offset, int length)
Decrypts
ciphertextin place and advances the state of the cipher.Bytes outside the designated offset/length are unchanged.
Don't forget to call verifyTag when decryption is complete.
-
-
-
-