CryptoSys API Library Manual

Gcm.InitKey Method

Initializes the context with the key ready for repeated operations of Gcm.NextEncrypt, Gcm.NextDecrypt, or Gcm.NextGmac.

Syntax

[C#]
public int InitKey(
	byte[] key
)
[VB.NET]
Public Function InitKey ( _
	key As Byte() _
) As Integer

Parameters

key
Key: must be exactly 16, 24 or 32 bytes long.

Return Value

Zero (0) if successful; otherwise it returns a nonzero error code

Remarks

Once a key has been set up, Gcm.NextEncrypt, Gcm.NextDecrypt and Gcm.NextGmac can be used independently.

Example

[C#]
Gcm o = Instance();
o.InitKey(key);
byte[] tag = new byte[16];
byte[] ct = o.NextEncrypt(tag, pt, iv, aad);
//...
o.Dispose();

See Also

VB6/C equivalent: GCM_InitKey

[Contents] [Index]

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

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