[openssl-dev] pkcs#7 signed data issue

ramyken ramyken at seznam.cz
Thu Dec 18 10:16:46 UTC 2014


Hi, i am trying to create pkcs#7 signed data structure and i have a problem
when using NID_pkcs7_signed (signedData content type) in PKCS7_content_new
function like this:

PKCS7_content_new(p7, NID_pkcs7_signed)

because when my app then calls PKCS7_dataFinal(p7,p7bio) i get a null
pointer in this construction (inside the scope of
PKCS7_dataFinal/pkcs7_doit.c function):

....
case NID_pkcs7_signed:
                si_sk=p7->d.sign->signer_info;
                os=PKCS7_get_octet_string(p7->d.sign->contents);    <------
NULL pointer returned to os
                /* If detached data then the content is excluded */
                if(PKCS7_type_is_data(p7->d.sign->contents) && p7->detached)
{
                        M_ASN1_OCTET_STRING_free(os);
                        p7->d.sign->contents->d.data = NULL;
                }
                break;
....

where PKCS7_get_octet_string(p7->d.sign->contents) gives NULL into os
variable and my app then crashes in the following condition when accesses
os->flags: if (!PKCS7_is_detached(p7) && !(os->flags &
ASN1_STRING_FLAG_NDEF)).

I know that this happens because PKCS7_get_octet_string and
PKCS7_type_is_other functions serves NID_pkcs7_signed type badly.

I am currently using openssl-1.0.1g, bad the problem is also in the latest
code as well.

Has anybody already tried to solve this?

thanks and regards,
Ken




--
View this message in context: http://openssl.6102.n7.nabble.com/pkcs-7-signed-data-issue-tp55518.html
Sent from the OpenSSL - Dev mailing list archive at Nabble.com.


More information about the openssl-dev mailing list