StartAESCipher()

Syntax

Result = StartAESCipher(#Cipher, *Key, Bits, *InitializationVector, Mode)
Description
Initializes a new AES cipher stream where data can be added using AddCipherBuffer().

Parameters

#Cipher The number which identifies this new cipher. #PB_Any can be used to auto-generate this number.
*Key A buffer containing the key for decoding. Its size depends of the 'Bits' parameter: 16 bytes for 128-bit encryption, 24 bytes for 196-bit and 32 bytes for 256-bit.
Bits The size of the key used by the ciphering. Valid values are 128, 192 and 256.
*InitializationVector The InitializationVector is a random data block, used to initialize the ciphering to avoid breach in decoding (only needed when using the #PB_Cipher_CBC mode). Its size depends of the 'Bits' parameter: 16 bytes for 128-bit encryption, 24 bytes for 196-bit and 32 bytes for 256-bit.
Mode This parameter can be a combination of one the following values:
  #PB_Cipher_Decode: The stream is used to decode data.
  #PB_Cipher_Encode: The stream is used to encode data.

with

  #PB_Cipher_CBC: Default mode of encoding (Cipher Block Chaining). Needs an '*InitializationVector'.
                  Recommended as more secure than ECB mode.
  #PB_Cipher_ECB: Alternative mode (Electronic CodeBook). It doesn't uses random value nor chaining 
                  (each block is ciphered independently) making it very weak compared to CBC, and shouldn't be used for
                  serious ciphering.

Return value

If #PB_Any was used as the #Cipher parameter then the auto-generated #Cipher number is returned.

Remarks

New buffers to be encoded or decoded can be added with AddCipherBuffer(). Once a cipher is finished, FinishCipher() has to be called.

For more information about AES, see AESEncoder().

See Also

AddCipherBuffer(), FinishCipher(), AESEncoder(), AESDecoder()

Supported OS

All

<- OpenCryptRandom() - Cipher Index - StartFingerprint() ->