Home Contents | # AES Initialization Vector | Cipher | Core4 Lua Commands

## SYNOPSIS

1. aes:setIV(iv)
2. iv = aes:getIV()
3. aes:clearIV()

## DESCRIPTION

Handling of the initialization vector used with the cipher block chaining mode of operation.

aes:setIV() updates the current IV value from iv, which must be a string of exactly 16 bytes length, since AES works in blocks of that size.

aes:clearIV() clears the current IV to zero.

As encryption or decryption of the data proceeds, the stored IV is updated and can be queried calling aes:getIV().

## RETURN VALUE

aes:getIV() returns a string containing the current IV value.

## ERRORS

Raises an error if aes is not an AES state handle as returned by cipher.aes().

## SEE ALSO

aes:cbcDecrypt, aes:cbcEncrypt, aes:decrypt, aes:encrypt, aes:padDecrypt, aes:padEncrypt, aes:setupDecrypt, aes:setupEncrypt, cipher.aes, cipher.random