PureBasic
PureBasic
Example: Crypt2.SetEncodedIV method
Demonstrates how to call the SetEncodedIV method.Chilkat PureBasic Downloads
IncludeFile "CkCrypt2.pb"
Procedure ChilkatExample()
crypt.i = CkCrypt2::ckCreate()
If crypt.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkCrypt2::setCkCryptAlgorithm(crypt, "aes")
CkCrypt2::setCkCipherMode(crypt, "cbc")
CkCrypt2::setCkKeyLength(crypt, 256)
; Note: The lenght of the IV is equal to the block size of the symmetric encryption algorithm.
; The block size for AES is 16 bytes. Therefore, the IV is 16 bytes regardless of the encryption strenght (128-bit, 256-bit, etc.)
CkCrypt2::ckSetEncodedIV(crypt,"000102030405060708090A0B0C0D0E0F","hex")
; ...
; ...
CkCrypt2::ckDispose(crypt)
ProcedureReturn
EndProcedure