Cipher.EncryptAEAD Method (Byte[], Byte[], Byte[], Byte[], AeadAlgorithm, Cipher.Opts)
Encrypt data using the AES-GCM authenticated encryption algorithm with AAD and options.
Syntax
[C#]
public static byte[] EncryptAEAD(
byte[] input,
byte[] key,
byte[] iv,
byte[] aad,
AeadAlgorithm aeadAlg,
Cipher.Opts opts
)
[VB.NET]
Public Shared Function EncryptAEAD ( _
input As Byte(), _
key As Byte(), _
iv As Byte(), _
aad As Byte(), _
aeadAlg As AeadAlgorithm, _
opts As Cipher.Opts _
) As Byte()
Parameters
- input
- Input data to be encrypted.
- key
- Key of exact length for algorithm (16, 24 or 32 bytes).
- iv
- Initialization Vector (IV) (aka nonce) exactly 12 bytes long.
- aad
- Additional authenticated data (optional) - set as null to ignore.
- aeadAlg
- Type: AeadAlgorithm
Authenticated encryption algorithm.
- opts
- Type: Cipher.Opts
Advanced options. Use Cipher.Opts.PrefixIV to prepend the 12-byte IV to the output
Return Value
Ciphertext with tag appended in a byte array, or empty array on error.
Remarks
The output will either be exactly 16 bytes longer than the input, or exactly 28 bytes longer if Cipher.Opts.PrefixIV is used.
See Also
VB6/C equivalent: CIPHER_EncryptAEAD
[Contents] [Index]