Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Graham Leggett
Hi all, I would like to know how long a CRL has until it expires in seconds (or milli or microseconds, don't care, I can convert), and am struggling to find a formally supported way to do this. What I would like to do is return the difference between a given ASN1_TIME and the current time, or

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Jakob Bohm
On 11/7/2012 2:35 PM, Graham Leggett wrote: Hi all, I would like to know how long a CRL has until it expires in seconds (or milli or microseconds, don't care, I can convert), and am struggling to find a formally supported way to do this. What I would like to do is return the difference

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Graham Leggett
On 07 Nov 2012, at 3:57 PM, Jakob Bohm jb-open...@wisemo.com wrote: Look in the code that checks certificates for expiry (during certificate validation), it probably calls an appropriate subroutine on the expiry date in the X509 cert. Already did that, the function you're referring to is

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Dirk-Willem van Gulik
On 7 Nov 2012, at 14:35, Graham Leggett wrote: I would like to know how long a CRL has until it expires in seconds (or milli or microseconds, don't care, I can convert), and am struggling to find a formally supported way to do this. What I would like to do is return the difference

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Graham Leggett
On 07 Nov 2012, at 4:08 PM, Dirk-Willem van Gulik di...@webweaving.org wrote: The bit of code I stole from x509/x509_vfy.c works for me. Dw. if(!(X509_CRL_get_nextUpdate(crl)) return -1; int i=X509_cmp_time(X509_CRL_get_nextUpdate(crl), ptime); if (i

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Dr. Stephen Henson
On Wed, Nov 07, 2012, Graham Leggett wrote: Hi all, I would like to know how long a CRL has until it expires in seconds (or milli or microseconds, don't care, I can convert), and am struggling to find a formally supported way to do this. What I would like to do is return the difference

RE: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Charles Mills
the difference in (milli|micro)seconds between two ASN1_TIME values On Wed, Nov 07, 2012, Graham Leggett wrote: Hi all, I would like to know how long a CRL has until it expires in seconds (or milli or microseconds, don't care, I can convert), and am struggling to find a formally supported way

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Ted Byers
On Wed, Nov 7, 2012 at 9:20 AM, Graham Leggett minf...@sharp.fm wrote: What I'm after is the difference between the given date and now so that I can construct a max-age value for Cache-Control. At this stage, there doesn't seem to be a way to do this in openssl. Regards, Graham -- Why

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Jakob Bohm
Of Dr. Stephen Henson Sent: Wednesday, November 07, 2012 9:33 AM To: openssl-users@openssl.org Subject: Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values On Wed, Nov 07, 2012, Graham Leggett wrote: Hi all, I would like to know how long a CRL has until it expires in seconds

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Dr. Stephen Henson
On Wed, Nov 07, 2012, Charles Mills wrote: A struct tm is only granular down to whole seconds, right? Yes but in this usage case it isn't that significant. Various standards (RFC5280 et al) ban the use of fractional seconds in time representations. Steve. -- Dr Stephen N. Henson. OpenSSL

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Graham Leggett
On 07 Nov 2012, at 4:50 PM, Ted Byers r.ted.by...@gmail.com wrote: Why does it need to be something in openssl? Ideally because it needs to be as secure as openssl. I'm after an accurate time duration between two ASN1_TIME values, that is not dependent on local conditions, or any external

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Peter Sylvester
On 11/07/2012 06:52 PM, Graham Leggett wrote: On 07 Nov 2012, at 4:50 PM, Ted Byers r.ted.by...@gmail.com wrote: Why does it need to be something in openssl? Ideally because it needs to be as secure as openssl. I'm after an accurate time duration between two ASN1_TIME values, that is not

Re: [openssl-users] Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Erwann Abalea
Le 07/11/2012 16:08, Jakob Bohm a écrit : On 11/7/2012 3:39 PM, Charles Mills wrote: A struct tm is only granular down to whole seconds, right? Yes, and it is not the easiest data type for data math either, even when restricted to GMT/UT1/UTC. Plus many OS/compiler supplied struct tm related

Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Jakob Bohm
On 11/7/2012 7:20 PM, Peter Sylvester joked: On 11/07/2012 06:52 PM, Graham Leggett wrote: On 07 Nov 2012, at 4:50 PM, Ted Byers r.ted.by...@gmail.com wrote: Why does it need to be something in openssl? Ideally because it needs to be as secure as openssl. I'm after an accurate time duration

Re: [openssl-users] Re: Find the difference in (milli|micro)seconds between two ASN1_TIME values

2012-11-07 Thread Jakob Bohm
On 11/7/2012 7:34 PM, Erwann Abalea wrote: Le 07/11/2012 16:08, Jakob Bohm a écrit : On 11/7/2012 3:39 PM, Charles Mills wrote: A struct tm is only granular down to whole seconds, right? Yes, and it is not the easiest data type for data math either, even when restricted to GMT/UT1/UTC. Plus