On Tue, Jul 29, 2014, Konstantin Shemyak wrote: > Hello everyone, > > I cannot read data from stdin - like this: > > BIO *in = BIO_new_fp(stdin, BIO_NOCLOSE); > BIO *out = BIO_new_fp(stdout, BIO_NOCLOSE); > > PKCS7 *signed_data = PKCS7_sign(NULL, NULL, NULL, in, > PKCS7_NOATTR | PKCS7_DETACHED | PKCS7_PARTIAL); > PKCS7_sign_add_signer(signed_data, sign_cert, priv_key, > nonstandard_digest, > PKCS7_NOATTR); > PKCS7_final(signed_data, NULL, 0); > PEM_write_bio_PKCS7_stream(out, signed_data, NULL, 0); > > The result on the stdout is a valid signature, but of 0-byte data. > STDIN is not even > being read, as I see from output of strace. > In real code, I check return values of *all* OpenSSL functions and > none returns an error. > > What am I missing?? >
Don't call PKCS7_final and pass the content BIO and appropriate flags to PEM_write_bio_PKCS7_stream(). 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