Skip to content

confusion between ASN1_UTCTIME and ASN1_GENERALIZEDTIME #208

@msalle

Description

@msalle

In various places the GCT is confusing ASN1_UTCTIME and ASN1_GENERALIZEDTIME, assuming ASN1_TIME is always a ASN1_UTCTIME.

globus_gsi_cert_utils_make_time in globus_gsi_cert_utils.c is only valid for ASN1_UTCTIME, since it assumes 2-digit years, but is also used to parse any ASN1_TIME, for example in myproxy's ssl_get_times() and numerous other places.

In particular globus_gsi_cert_utils.c lines 245-250 assumes that the year is always 2 digits. That is only true when the type is V_ASN1_UTCTIME, i.e. 23. However, from 1/1/2050, it will get encoded as a V_ASN1_GENERALIZEDTIME (i.e. 24) and will take 4 digits.

See https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.5 and https://stackoverflow.com/q/10975542 but more in particular https://stackoverflow.com/a/59721373.
The last link also points to ASN1_TIME_to_tm which will work from 1.1.1 onwards. Since we still need to support 1.0.2 we cannot use it always unfortunately.

We probably can rework the whole code to use ASN1_TIME_diff() instead, which does already work for 1.0.2 and can even directly get the current time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions