I just wanted to DES 4096 bytes of data with a 128 bits key...

Posted by badp on Stack Overflow See other posts from Stack Overflow or by badp
Published on 2011-01-10T00:21:02Z Indexed on 2011/01/10 0:54 UTC
Read the original article Hit count: 160

Filed under:
|
|

...and what the nice folks at OpenSSL gratiously provide me with is this. :)

Now, since you shouldn't be guessing when using cryptography, I come here for confirmation: what is the function call I want to use?


What I understood

A 128 bits key is 16 byte large, so I'll need double DES (2 × 8 byte). This leaves me with only a few function calls:

void DES_ede2_cfb64_encrypt(const unsigned char *in,
       unsigned char *out, long length, DES_key_schedule *ks1,
       DES_key_schedule *ks2, DES_cblock *ivec, int *num, int enc);

void DES_ede2_cbc_encrypt(const unsigned char *input,
       unsigned char *output, long length, DES_key_schedule *ks1,
       DES_key_schedule *ks2, DES_cblock *ivec, int enc);

void DES_ede2_cfb64_encrypt(const unsigned char *in,
       unsigned char *out, long length, DES_key_schedule *ks1,
       DES_key_schedule *ks2, DES_cblock *ivec, int *num, int enc);

void DES_ede2_ofb64_encrypt(const unsigned char *in,
       unsigned char *out, long length, DES_key_schedule *ks1,
       DES_key_schedule *ks2, DES_cblock *ivec, int *num);

In this case, I guess the function I want to call DES_ede2_cfb64_encrypt, although I'm not so sure -- I definitely don't need padding here and I'd have to care about what ivec and num are, and how I want to generate them...

What am I missing?

© Stack Overflow or respective owner

Related posts about c

    Related posts about cryptography