Anirudh or Mike,
Has there been any progress on this? I am in the same situation, but the other way around.
I created a cipher using the demo web page (
http://bitwiseshiftleft.github.io/sjcl/demo/) , but cannot get it to decipher using OpenSSL.
Even more directly, I wrote a basic test routine in C. I simply take the 16 byte IV and the 256 bit passkey from the demo page, code them into my C program, and pass it directly to the AES_cbc_encrypt function. Specifically:
AES_cbc_encrypt(src, dst, len, &aeskey, initVect, AES_DECRYPT);
but the result is that it won't decipher even my original text.
The demo web pages say "SJCL adds a an authentication tag to your message ..." But doesn't tell me what that tag value is, if it is ciphered or not, or where it is placed (beginning or end)
Any guidance would be appreciated. My simple code is below (obvious declarations not pasted to save space)
-Scott Weber
/* Note: the Key/IV values are correct, I see them in the debugger matching the values from the demo page */
unsigned char key32[] =
{0x52,0xB0,0x7A,0x77,0x95,0x5E,0x4E,0xCB,0x50,0xBC,0x32,0xDB,0xE7,0x91,0xB0,0x27,
0x4C,0x2E,0x25,0xB4,0x55,0xC1,0x56,0x2E,0xBA,0x97,0x00,0xB6,0x65,0xF0,0x31,0xBA };
void AES256Decrypt(char *dst, const unsigned char * src, int len) {
AES_KEY aeskey;
memcpy(initVect,iv,sizeof(initVect));
AES_set_decrypt_key((unsigned char *)key32, 32*8, &aeskey);
AES_cbc_encrypt((unsigned char *)src,(unsigned char *) dst, len, &aeskey, initVect, AES_DECRYPT);
}
int main() {
strcpy(base64cipher,"6i6Xa7YjTjLDkXDGIHJtqowADpd/Z08=");
strcpy(base64iv,"rMbY94LVjJ/Ne9LkXHy3qw==");
len = Base64Decode(iv,base64iv,strlen(base64iv));
len = Base64Decode(cipher,base64cipher,strlen(base64cipher));
AES256Decrypt(cleartext,cipher,len);
return 0;