On Mon, May 19, 2008, Massimiliano Ziccardi wrote: > Hi Stephen. > Thank you very much! > > This is my code (just a snippet): > > STACK_OF(X509_ATTRIBUTE)* unauth_attr = pSignerInfo->unauth_attr; > ASN1_TYPE *res = PKCS7_get_attribute(m_pSignerInfo, > NID_pkcs9_countersignature); > > Now, res should point to a SEQUENCE of COUNTER SIGNATUREs. >
No it contains the encoding of a single counter signature. The specs state that you can have either one ore more counter signature attributes or more than one countersignature per attribute. You need to iterate over the attributes and each attribute to find all countersignatures. That is a bit messy and there should really be a function to do this. > You told: > > >You need to extract the ASN1_STRING structure form ASN1_TYPE and then its > data > >and length > > you mean: > > res->value.sequence->data > res->value.sequence->length > > ? > You should avoid accessing structures directly where possible but there isn't anything here which can extract the data. So you need something like... ASN1_STRING *csig = res->value.sequence; Then get the length with ASN1_STRING_length() and its data with ASN1_STRING_data(). Then pass those through d2i_PKCS7_SIGNER_INFO() see FAQ and docs for details and pitfalls. 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]
