Chen Song
Chen Song

Reputation: 1

openssl verify signature error, but command line tools is ok

i am working on veifying signature of ECDSA-WITH-SHA256. my code base is from openssl v1.0.1h, it is ok to run with openssl command line. but my code return error when executing code below:

if (!(p7bio=PKCS7_dataInit(p7,tmpin)))
    goto err;

the code in PKCS7_dataInit is below:

for (i=0; i<sk_X509_ALGOR_num(md_sk); i++)
    if (!PKCS7_bio_add_digest(&out, sk_X509_ALGOR_value(md_sk, i)))
        goto err;

PKCS7_bio_add_digest return error so that verification is failed.

i construct the exactly same command line parameters like command line tools below: [openssl smime] -verify -inform DER -in signature -content message -noverify

what cause this problem?

appreciate for any help

Chen Song

Upvotes: 0

Views: 403

Answers (1)

Vladimir Kunschikov
Vladimir Kunschikov

Reputation: 1763

You forgot to call SSL_library_init() at application startup? In order to get more info you should read verbose ssl errors by calling ERR_get_error() and ERR_error_string_n() at your 'err' label.

Upvotes: 1

Related Questions