On Sun, Apr 22, 2007 at 11:44:22PM +0200, Michal wrote:
> Hi,
>
> I have written encrypt/decrypt functions that use blowfish and the issue is
> that they works fine if the input string length is divisible by 8. I have
> found in docs that blowfish uses 8 byte blocks. So I must do padding. Do I
> have to do it manually or is there any function that does it for me ?
> encrypt:
>
> void encrypt_message(const char *buffin, size_t buffinSize, char
> **buffout, const
> char *key)
> {
>
> BIO *mem = BIO_new(BIO_s_mem());
> BIO *b64=BIO_new(BIO_f_base64());
> BIO *cipher=BIO_new(BIO_f_cipher());
> BIO_set_cipher(cipher, EVP_bf_ecb(), (unsigned char*)key, NULL,1);
Don't use ECB to encrypt data streams. You need at least CBC, and probably
an integrity layer (MAC) also. Read the "openssl enc" source code..
--
Viktor.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]