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...

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.


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

Reply via email to