<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1448370974404_2555">  Hello,<br id="yui_3_16_0_1_1448370974404_2556">I am trying to verify the timestamp in a file signed using Authenticode.<br id="yui_3_16_0_1_1448370974404_2557">I have found that this timestamp is in the RFC3161 format.<br id="yui_3_16_0_1_1448370974404_2558">Using openssl apis, I have parsed the Authenticode signature and reached the oid 1.3.6.1.4.1.311.3.3.1. I have subsequently used the following apis :</div><div id="yui_3_16_0_1_1448370974404_2559">------------------------------------------------------------------------<br id="yui_3_16_0_1_1448370974404_2560">ASN1_OBJECT *obj;</div><div id="yui_3_16_0_1_1448370974404_2561">        obj = OBJ_txt2obj("1.3.6.1.4.1.311.3.3.1", 1);<br id="yui_3_16_0_1_1448370974404_2562">        int cmp = -1;<br id="yui_3_16_0_1_1448370974404_2563">        <br id="yui_3_16_0_1_1448370974404_2564">        attr = sk_X509_ATTRIBUTE_value(pSkUnauthAttr, 0);<br id="yui_3_16_0_1_1448370974404_2565">        if (0 == (cmp = OBJ_cmp(attr->object, obj)))<br id="yui_3_16_0_1_1448370974404_2566">        {<br id="yui_3_16_0_1_1448370974404_2567">            ASN1_TYPE *asn1_type = NULL;<br id="yui_3_16_0_1_1448370974404_2568">            asn1_type = sk_ASN1_TYPE_value(attr->value.set, 0);<br id="yui_3_16_0_1_1448370974404_2569">            <br id="yui_3_16_0_1_1448370974404_2570">            if (V_ASN1_SEQUENCE == asn1_type->type)<br id="yui_3_16_0_1_1448370974404_2571">            {           <br id="yui_3_16_0_1_1448370974404_2572">                ptr = asn1_type->value.octet_string->data;</div><div id="yui_3_16_0_1_1448370974404_2573">                ts_pkcs7 = d2i_PKCS7(NULL, &ptr, (int)asn1_type->value.octet_string->length);<br id="yui_3_16_0_1_1448370974404_2574">------------------------------------------------------------------------</div><div id="yui_3_16_0_1_1448370974404_2575">Since the sequence following the oid is of type PKCS7_signed_data, I expected d2i_PKCS7 to convert it after which I would be able to reach id-smime-ct-TSTInfo. <br id="yui_3_16_0_1_1448370974404_2576">But d2i_PKCS7 fails returning NULL. I would appreciate if someone who has done something similar and faced this problem can help me. <br id="yui_3_16_0_1_1448370974404_2577">I am unable to move forward so any help would be greatly appreciated.</div><div id="yui_3_16_0_1_1448370974404_2578" dir="ltr">Thanks,<br id="yui_3_16_0_1_1448370974404_2579">Leena.<br id="yui_3_16_0_1_1448370974404_2580"></div></div></body></html>