This is a discussion on [openssl.org #1385] SMIME_read_PKCS7 fails with memory BIO but works with file BIO - Openssl ; I am trying to use SMIME_read_PKCS7 to read a signed and encrypted MIME
message from memory BIO, but I can't get it to work. It works fine if I
construct a file BIO to read from. I can't see anything ...

[openssl.org #1385] SMIME_read_PKCS7 fails with memory BIO but works with file BIO

I am trying to use SMIME_read_PKCS7 to read a signed and encrypted MIME
message from memory BIO, but I can't get it to work. It works fine if I
construct a file BIO to read from. I can't see anything I am doing wrong
(and nobody answered to my openssl-users post about this) so I am
assuming this is a bug, hence filing this ticket.

See the test application below that shows the problem. Please note that
you need to save the contents of smime_text variable into a file called
"smime_text.txt" manually, before the file BIO case will work.

When I run the program, I get the following output:

3445
Memory BIO case, error: 218542222

This is on Cygwin, with OpenSSL 0.9.8a. (I think I tested this earlier
on various other OSes with same results.)