CryptoSys API Library Manual

Gcm.Encrypt Method

Encrypt input using AES-GCM in one-off operation

Syntax

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

Parameters

tag
To receive the output authentication tag value. Always returned exactly 16 bytes long. You may truncate as desired. This is a by-reference parameter. There is no need to initialize (but the VB compiler may complain).
input
Plain text input data
key
Key: must be exactly 16, 24 or 32 bytes long.
iv
Initialization vector: can be any length but 12 bytes is recommended.
aad
Additional authentication data (optional). Pass null/Nothing to ignore.

Return Value

Encrypted ciphertext in byte array, or empty array on error

Remarks

If you just require a GMAC value, use Gcm.Gmac Use General.ErrorCode to find the code of the last error.

See Also

VB6/C equivalent: GCM_Encrypt

[Contents] [Index]

[PREV: Gcm.Dispose Method...]   [Contents]   [Index]   
   [NEXT: Gcm.Gmac Method...]

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