Sample code for 30+ languages & platforms
Java

Example: Crypt2.SetEncodedIV method

Demonstrates how to call the SetEncodedIV method.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.Crypt2;

public class ChilkatExample {

    public static void main(String[] args) {
        Crypt2 crypt = new Crypt2();

        crypt.setCryptAlgorithm("aes");
        crypt.setCipherMode("cbc");
        crypt.setKeyLength(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.)
        crypt.setEncodedIV("000102030405060708090A0B0C0D0E0F", "hex");

        // ...
        // ...
    }
}