Encrypt input using specified AEAD algorithm in one-off operation.
Namespace: CryptoSysAPIAssembly: diCrSysAPINet (in diCrSysAPINet.dll) Version: 6.22.2.24248 (6.22.2.0)
Syntaxpublic static byte[] Encrypt(
out byte[] tag,
byte[] input,
byte[] key,
byte[] nonce,
byte[] aad,
AeadAlgorithm alg
)
Public Shared Function Encrypt (
<OutAttribute> ByRef tag As Byte(),
input As Byte(),
key As Byte(),
nonce As Byte(),
aad As Byte(),
alg As AeadAlgorithm
) As Byte()
Parameters
- tag Byte
- To receive the output authentication tag value.
Currently always returned exactly 16 bytes long.
This is a by-reference parameter. There is no need to initialize (but the VB compiler may complain).
- input Byte
- Plain text input data (required)
- key Byte
- Key of exact length for given algorithm (16 or 32 bytes)
- nonce Byte
- Nonce of exact length for given algorithm (currently always 12 bytes)
- aad Byte
- Additional authentication data (optional). Pass null/Nothing to ignore.
- alg AeadAlgorithm
- AEAD algorithm to use
Return Value
ByteEncrypted ciphertext in byte array, or empty array on error
Remarks
Use
General.ErrorCode to find the code of the last error.
The ciphertext is always the same length as the plaintext. The authentication tag is output separately.
See Also