On Mon, May 19, 2008, Massimiliano Ziccardi wrote:
> Hi all.
>
> Here is my problem.
>
> I have a P7M file with 2 signatures. Every signature contains a
> countersignature.
>
> I've already successfully parsed the P7M file, and I've got the two
> Signature infos.
>
> What I do next is:
>
> ASN1_TYPE *res = PKCS7_get_attribute(m_pSignerInfo,
> NID_pkcs9_countersignature);
> printf ("SEQUENCE ? %d\n", V_ASN1_SEQUENCE == res->type);
>
> The output is
>
> SEQUENCE ? 1
>
> So, I'm sure I got an ASN1_SEQUENCE.
>
> How can I loop through the values of the sequence? Do I have to convert it
> to a STACK_OF(PKCS7_SIGNER_INFO) ? If yes, how can I do it (sorry, I'm not
> very expert about OpenSSL...) ?
>
You need to extract the ASN1_STRING structure form ASN1_TYPE and then its data
and length. If you pass those through d2i_PKCS7_SIGNER_INFO() you'll get the
parsed structure.
Note that the above will only retrieve a single countersignature. There could
be more than on per SignerInfo structure. If you want to see if there is more
than one you need to loop round all attributes of the correct type.
Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]