On Mon, Oct 05, 2009, Srirang Doddihal wrote: > Hi Steve, > > On Mon, Oct 5, 2009 at 5:11 PM, Dr. Stephen Henson <st...@openssl.org>wrote: > > > [snipped] > > > > Does this simpler version help: > > > > http://www.openssl.org/support/faq.html#PROG15 > > > > Thank you for pointing me to this. I understand it better now. However the > problem is still unresolved. > > >From the FAQ I understand that if I were to do BIO_set_mem_eof_return(bio, > 0), then the behavior should be similar to a file bio and my code to read > decoded data should work. But it doesn't. > > Here is the code: http://pastebin.ca/1594435 > > To verify that it is the eof behavior that is causing this problem I tried > reading directly from the memory bio without making this call : > BIO_set_mem_eof_return(bio, 0). I could successfully read the base64 data > present in the mem bio and in the next call to read all the parameters were > appropriately set to indicate that I should stop reading, namely: > > 1) BIO_read returned -1 > 2)One of the two flags, should_retry or should_read, was false > > So if reading directly from the memory bio works fine, why doesn't it work > in a chain with a base64 bio? Is it the case that the base64 bio expects its > source bio to be in some particular state or to be of a particular type? If > so, what are those particular properties? >
Does your file have a newline at the end of that data? If I place a newline on it in your program string then it works. If you don't use newlines then as documented you need to set: BIO_FLAGS_BASE64_NO_NL with BIO_set_flags(). Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org