> hi all,
>now i'm able to get the certificate timing info. by using the call
X509_get_notAfter() and X509
> _get_notBefore()but they are returning the values in integer type( in
my case, both return 13 and 13)
> so anybody can help me out to get the timing info. in proper date format.
hi DS, here is the code snippet i'm using: X509 *cert; FILE fp; fp=fopen("cacert.der","r"); /* error check*/ cert=d2i_X509_fp(fp,NULL); /* error check*/ printf("Valid From : %d",X509_get_notBefore(cert)); /*gives 13 and when printed using %s, it gives segmentation fault*/
> hi DS,
>here is the code snippet i'm using:
>
> X509 *cert;
> FILE fp;
> fp=fopen("cacert.der","r");
> /* error check*/
> cert=d2i_X509_fp(fp,NULL);
> /* error check*/
> printf("Valid From : %d",X509_get_notBefore(cert));
> /*gives 13 and when printed using %s, it gives
>
Stephan, This function "X509_get_notBefore(cert));" returns a ASN1_TIME pointer so u cannot print out the results using %d which is for integers or maybe it prints out something but not correct. Now just call like this: ASN1_TIME *cert_time; char *pstring; cert_time = X509_get_notBefore(cert));
Here is another thread that converts the time to a string. It may be helpful in the future http://www.securitybuzz.org/buzz/emails/id/276651/vipin rathor <[EMAIL PROTECTED]> wrote:hi DS and all, i was just searching the mail archive and fortunately i got the conversation between "Tan Eng T