Dear OpenSSL users,

we want to want to operate on the Contents of a memory BIO
- eg digest - and tried out following implementation:

-------------
BIO *mb = BIO_new(BIO_s_mem());
// filling it with some data
char* message="This is some data to digest";
BIO_write(mb, message, sizeof(message));

// after the memory bio has been filled
BIO *dg = BIO_new(BIO_f_md()), *nul=BIO_new(BIO_s_null());
EVP_MD *md = EVP_md5();
BIO_set_md(dg,md);

// get all out of the mb and diget it
BIO_push(mb,dg);  // append digesting to mem-BIO
BIO_push(dg,nul); // get all out of digest-BIO
// BIO chain should be: mem-dgst-nul

// get the digest now
char mdbuf[EVP_MAX_MD_SIZE];
BIO_gets(dg, mdbuf, EVP_MAX_MD_SIZE);
-------------

but the memory BIO stays filled, even after performing
BIO_flush(mb) and the digest we get out of dg is the 
digesting start value.

So what am I missing? How can the propagation of 
the memory data through the filter BIO be triggered?

Thanks in advance
--
Christian Weber
mailto:[EMAIL PROTECTED]    Tel: 02361/91300
For information on InfoTech visit http://www.InfoTech.de

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to