Presently I am using the certificate authentication for one
In that one,am reading the certificate thru C program.
In that program am using the function called X509_get_ext_d2i.
When I am trying to retrieve the value of the extension serialNumber ,
it is throwing the error it couldn't find the extension serialNumber
in the certificate.
But in the certificate the serialNumber is available.Am bit confused
why it is throwing this kind of error?
And my code looks like below.

if(nid == FALSE)
fprintf(stderr,"Unable to get the NID for %s
return FALSE;

altnames = (STACK *)X509_get_ext_d2i(cert, nid, crit, idx);

In the above scenario first I am getting the nid of the extension by
passing the extension name.
In the second step, using the NID am getting the value of the

This code working fine for subjectalternativename extension.

In case anybody knows about this please let me know.