Multiple encrypt / decrypt with same BIO

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Multiple encrypt / decrypt with same BIO

Manuel Arguelles
I have managed to encrypt / decrypt data to one file using bio methods,
however is it possible to encrypt to different files using the same bio
cipher? for example something like this:

BIO *file = BIO_new_file("out.bin", "w");
BIO *buffer = BIO_new(BIO_f_buffer());
BIO *cipher = BIO_new(BIO_f_cipher());
BIO *file2 = BIO_new_file("out-2.bin", "w");

BIO_push(cipher, buffer);
BIO_push(buffer, file);

BIO_set_cipher(cipher, EVP_rc4(), key, NULL, 1);

BIO_write(cipher, data1, data1size);

BIO_push(buffer, file2);

BIO_write(cipher, data2, data2size);

the data of file2 gets corrupted, am I missing something?

OpenSSL Project                       
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]