May 30, 2014
Hi,

I'm try to encrypt a string with AES_cbc_encrypt using the openssl bindings from https://github.com/D-Programming-Deimos/openssl

And the result I got is wrong.

---
ubyte[32] key
// ...fill key

ubyte[16] iv;
// ...fill iv;

AES_KEY aes_key;
AES_set_encrypt_key(cast(const(ubyte)*)key.ptr,256,&aes_key);

ubyte[] test_in = cast(ubyte[])"foo";

ubyte[] test_out = new ubyte[](test_in.length + AES_BLOCK_SIZE - (test_in.length % AES_BLOCK_SIZE));

AES_cbc_encrypt(
    cast(const(ubyte)*) test_in.ptr,
    test_out.ptr,
    test_in.length,
    &aes_key,
    iv.ptr,
    AES_ENCRYPT);
---

What I'm doing wrong?