I am using 3des-ede-ebc encryption from openssl library.. the result cipher is encoded using base64. But the result cipher of encryption (both base564 and Hex encode) is different than the result from any online encryption site for same.
Eg: for 1234
My program output:
Hex : 722DDADAB2AFF81A
Base64 : ci3a2rKv+Bo=
from an online encryption tool
Hex : 0685EBBC2E239F72
Base64 : BoXrvC4jn3I=
//keys
des_cblock key1 = {0x73,0x64,0x73,0x64,0x33,0x34,0x35,0x34};
des_cblock key3 = {0x35,0x73,0x64,0x66,0x61,0x73,0x64,0x32};
des_cblock key2 = {0x33,0x32,0x73,0x64,0x73,0x33,0x33,0x34};
//Encryption
for(int incr = 0; incr < siL_Len; incr += 8)
{
DES_ecb3_encrypt((C_Block *)(in + incr), (C_Block *)(out + incr), &ks1, &ks2, &ks3, DES_ENCRYPT);
}
I am able to decrypt the cipher from my program result to its original value(both are different programs).. And base64 encoding is proper and verified.
I am missing something during/before encryption.May be some encoding/padding done before encryption..
what is the standard padding done for 3des ebc?? Any other pre-encryption steps are there?? I can't find any information about it ..
Can anyone help me.. thanks in advance..