AeadEncryptWithTag(Byte, Byte, Byte, Byte, AeadAlgorithm, AeadOpts) Method |
Encrypt data using specified AEAD algorithm in one-off operation with AAD and options. The authentication tag is appended to the output.
Namespace: CryptoSysAPIAssembly: diCrSysAPINet (in diCrSysAPINet.dll) Version: 6.22.2.24248 (6.22.2.0)
Syntaxpublic static byte[] EncryptWithTag(
byte[] input,
byte[] key,
byte[] iv,
byte[] aad,
AeadAlgorithm aeadAlg,
AeadOpts opts = AeadOpts.Default
)
Public Shared Function EncryptWithTag (
input As Byte(),
key As Byte(),
iv As Byte(),
aad As Byte(),
aeadAlg As AeadAlgorithm,
Optional opts As AeadOpts = AeadOpts.Default
) As Byte()
Parameters
- input Byte
- Input data to be encrypted.
- key Byte
- Key of exact length for algorithm (16 or 32 bytes).
- iv Byte
- Initialization Vector (IV) (aka nonce) (16 bytes for ASCON-128 else 12 bytes).
- aad Byte
- Additional authenticated data (optional) - set as null to ignore.
- aeadAlg AeadAlgorithm
- Authenticated encryption algorithm.
- opts AeadOpts (Optional)
- Advanced options (optional). Use Opts.PrefixIV to prepend the IV to the output
Return Value
ByteCiphertext with tag appended in a byte array, or empty array on error.
RemarksThe output will either be exactly 16 bytes longer than the input, or 28/32 bytes longer if Aead.Opts.PrefixIV is used.
See Also