What may have impact here is that a memory s/s BIO does not act like a file BIO by default. To get the same behaviour (at end-of-data == End of File), you should add the call
BIO_set_mem_eof_return(pio, 0); after the line > pio = BIO_new(BIO_s_mem()) to ensure you'll get a regular EOF signal when the memory buffer has been read in its entirety. On Thu, Apr 9, 2009 at 12:59 PM, Anton D Kachalov <mo...@altlinux.org> wrote: > Good day! > > I have problem with reading S/MIME PKCS#7 container from membuf. I've got > "not enough data" error in ASN parsing routine (asn1_d2i_read_bio). > I have sign & crypt zip file (430kb) with S/MIME PKCS#7 within PHP. Then I > wrote a small application to decrypt & verify: > /* Decrypt */ > in = BIO_new_file("sign_n_enc.file", "rb") > pio = BIO_new(BIO_s_mem()) > p7 = SMIME_read_PKCS7(in) > PKCS7_decrypt(p7, key, recip, pio, 0) > /* Verify */ > p7 = SMIME_read_PKCS7(pio, &datain) > PKCS7_verify(p7, NULL, store, datain, out, 0) > > If I create pio as: > pio = BIO_new_file("_tmpfile_", "w+") > p7 = SMIME_read_PKCS7(in) > PKCS7_decrypt(p7, key, recip, pio, 0) > BIO_seek(pio, 0) > p7 = SMIME_read_PKCS7(pio,...) > PKCS7_verify(p7, NULL, store, datain, out, 0) > > Then I would be success in verify. > My OpenSSL version is 0.9.8j. > > Rgds, > Anton > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-us...@openssl.org > Automated List Manager majord...@openssl.org > -- Met vriendelijke groeten / Best regards, Ger Hobbelt -------------------------------------------------- web: http://www.hobbelt.com/ http://www.hebbut.net/ mail: g...@hobbelt.com mobile: +31-6-11 120 978 -------------------------------------------------- ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org