> Are there any OpenSSL function to convert an ASN1_UTCTIME to a time_t (or a
> string for that matter)?

Somewhere in the following you'll find what you want :

time_t TSPX_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm,int gmt) {

        unsigned char strtime[30] ;

        time_t test = (time_t) 0;  int i ;
        if (tm->length != 15) return (time_t)-1;

        for (i = ( sizeof(time_t)*8-2) ; i>=0; i--) {           
                test += (time_t)(1 << i) ;
                strftime(strtime, 16, "%Y%m%d%H%M%SZ",gmtime(&test));
                if (strncmp(tm->data,strtime,15) < 0) 
                        test -= (time_t)(1 << i) ;
        } 
        if (bp) {
        strftime(strtime, 30, "%d-%b-%Y %H:%M:%S",localtime(&test));

        BIO_printf(bp,"%s",strtime) ; 
        if (gmt) {
        BIO_puts(bp," (");

        i = ASN1_GENERALIZEDTIME_print(bp, tm) ; 
        BIO_puts(bp,")");
        }
        }

        return test;

}

> 
> Also... what about converting an ASN1_INTEGER to a standard 'int'?
> 

what about 

   long ASN1_INTEGER_get(ASN1_INTEGER *a)

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to