CryptoSys API Library Manual

Aead.EncryptWithTag Method (Byte[], Byte[], Byte[], Byte[], Aead.Algorithm, Aead.Opts)

Encrypt data using specified AEAD algorithm in one-off operation with AAD and options. The authentication tag is appended to the output.

Syntax

[C#]
public static byte[] EncryptWithTag(
	byte[] input,
	byte[] key,
	byte[] iv,
	byte[] aad,
	Aead.Algorithm aeadAlg,
	Aead.Opts opts
)
[VB.NET]
Public Shared Function EncryptWithTag ( _
	input As Byte(), _
	key As Byte(), _
	iv As Byte(), _
	aad As Byte(), _
	aeadAlg As Aead.Algorithm, _
	opts As Aead.Opts _
) As Byte()

Parameters

input
Input data to be encrypted.
key
Key of exact length for algorithm (16 or 32 bytes).
iv
Initialization Vector (IV) (aka nonce) (16 bytes for ASCON-128 else 12 bytes).
aad
Additional authenticated data (optional) - set as null to ignore.
aeadAlg
Type: Aead.Algorithm
Authenticated encryption algorithm.
opts
Type: Aead.Opts
Advanced options (optional). Use Opts.PrefixIV to prepend the 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 28/32 bytes longer if Aead.Opts.PrefixIV is used.

See Also

VB6/C equivalent: AEAD_EncryptWithTag

[Contents] [Index]

[PREV: Aead.EncryptWithTag Method (Byte, Byte, Byte, Aead.Algorithm)...]   [Contents]   [Index]   
   [NEXT: Aead.FinishDecrypt Method...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.