Hello Sukalp,

I have tried to use the code snippet provided by use . I am able to create
the ASN_object and get the data also.but the data is not in readable form.

I use X509 instead of X509V3.

Here is the code that i have used :

*Ret = X509_get_ext_by_NID(cert, field_NID, 0);
        if ((Ret > 0) && (ext = X509_get_ext(cert, Ret)))
        {

            ASN1_OBJECT *obj;

            obj=OBJ_nid2obj(field_NID);
            if (obj == NULL) return(-2);
            return(X509_get_ext_by_OBJ(cert,obj,0));
        }*
The object snippet that i have found is


Please help me to get the data in readable format.

Regards.
Puneet

On Wed, Jul 25, 2012 at 12:37 PM, Sukalp Bhople <bsuk...@gmail.com> wrote:

> Hi,
>
> You will have to go through Openssl source code.
>
> Have a look at following files:
>
> 1. x509_v3.c (around line 74), You will find the following method:
>
> int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, int nid,
>   int lastpos)
>  {
> ASN1_OBJECT *obj;
>
> obj=OBJ_nid2obj(nid);
>  if (obj == NULL) return(-2);
> return(X509v3_get_ext_by_OBJ(x,obj,lastpos));
>  }
>
>
> Hope this helps.
>
>
> On Wed, Jul 25, 2012 at 7:08 AM, Puneet Khunteta <
> khunteta.pun...@gmail.com> wrote:
>
>> Hello,
>>
>> I am an user of openssl library.
>> I am seeking for a method to get the "Extended Key Usage" field from the
>> X509 certificate .
>> I will be grateful if you can provide me a sample code in c.
>>
>> Thanks
>> Puneet K.
>>
>
>
>
> --
> Regards,
> *Sukalp Bhople.*
>
>

Reply via email to