>       From: [email protected] On Behalf Of r r
>       Sent: Monday, 28 June, 2010 01:47

>               I have PKCS7 signed image in DER format, Verifing with
d2i_PKCS7_bio

That just parses, it doesn't verify. If you want to verify, 
you'll need additional code after the load succeeds.

>       API is always success for first time, but each next failed(returns
p7 as NULL). 
> What might be wrong in following code?

>       BIO *in=NULL; 
>       PKCS7 *p7=NULL;
>       in=BIO_new(BIO_s_file());
>       BIO_read_filename(in, fileSigned);
>       if (in == NULL) 
>       {
>         BIO_printf(bio_err,"load err\n");
>         exit(1);
>       }
>       p7=d2i_PKCS7_bio(in,NULL);
>       if (p7==NULL)
>       {
>         BIO_printf(bio_err,"load pkcs7 err\n");
>         BIO_free(in);
>         in = NULL;
>         exit(1);
>       }

Assuming you give it a valid file both/all times, I see nothing obvious.
But after any error on a libcrypto operation (and many but not all libssl) 
your program should display the error queue for detailed information. 
Since you have an error bio, the easiest way is ERR_print_errors (err_bio).
http://www.openssl.org/support/faq.html#PROG6 (and perhaps 7).


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to