On Tue, Aug 07, 2001 at 11:40:19PM +0100, Dr S N Henson wrote:
> Peter Shannon wrote:
> > 
> > Hi Martin,
> > 
> > On Tuesday 07 August 2001 12:06, you wrote:
> > > Is there a way to get out the 'timestamp' from an ASN1_TIME structure so I
> > > can compare it with other times? Yes I know there are _cmp functions but I
> > > want to be able to use < and >...
> > >
> > > Martin
> > 
> > I'm writing some Python wrappers at the moment and hade to do the same thing
> > on several occations and used a helper to get a time in seconds...
> > 
> [example deleted]
> 
> For ASN1_TIME its more complex than that. You need to check the 'type'
> field which can be V_ASN1_UTCTIME or V_ASN1_GENERALIZEDTIME. Also the
> two types present problems for the Unix time_t which is typically 32
> bits. Both types could in theory produce times outside the 32 bit range,
> UTCTime can represent dates before 1970 and GeneralizedTime can
> represent any 4 digit year. 
> 
> Its also possible to have time zones: this isn't allowed in DER encoding
> but nevertheless some broken certificates include them. Also
> GeneralizedTime can include a fractional seconds with arbitrary
> accuracy.
> 
> All this makes things a little bit trickier...

I can see that it would.  I wrote a 'has_expired' function instead and
that will do the trick.  Thank you for the explanation!

Martin

-- 
Martin Sjögren
  [EMAIL PROTECTED]              ICQ : 41245059
  Phone: +46 (0)31 405242        Cell: +46 (0)739 169191
  GPG key: http://www.strakt.com/~martin/gpg.html
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to