On Mon, Oct 5, 2009 at 9:21 PM, Dr. Stephen Henson <st...@openssl.org>wrote:
> 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. > No, it does not. I confirmed it multiple times. I am attaching the file that I am using, in case you want to take a closer look. There is no new line and without setting the below mentioned flag, decoding works just fine with file bio. The encoded text is not Hello World, but I tried the same text with both BIOs. > If you don't use newlines then as documented you need to set: > BIO_FLAGS_BASE64_NO_NL with BIO_set_flags(). > However, this method does solve the current problem. Decoding from the memory BIO now works well with this flag and the set_eof flag together. Thank you. > > 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 > -- Regards, Brahmana. The LIGHT shows the way. The WISE see it. The BRAVE walk it. The PERSISTENT endure and complete it. I want to do it all ALONE.
encoded-src
Description: Binary data