CryptoSys API Library Manual

Aead.Encrypt Method

Encrypt input using specified AEAD algorithm in one-off operation.

Syntax

[C#]
public static byte[] Encrypt(
	out byte[] tag,
	byte[] input,
	byte[] key,
	byte[] nonce,
	byte[] aad,
	Aead.Algorithm alg
)
[VB.NET]
Public Shared Function Encrypt ( _
	<OutAttribute> ByRef tag As Byte(), _
	input As Byte(), _
	key As Byte(), _
	nonce As Byte(), _
	aad As Byte(), _
	alg As Aead.Algorithm _
) As Byte()

Parameters

tag
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
Plain text input data (required)
key
Key of exact length for given algorithm (16 or 32 bytes)
nonce
Nonce of exact length for given algorithm (currently always 12 bytes)
aad
Additional authentication data (optional). Pass null/Nothing to ignore.
alg
Type: Aead.Algorithm
AEAD algorithm to use

Return Value

Encrypted 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

VB6/C equivalent: AEAD_Encrypt

[Contents] [Index]

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

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