1X509_CMP_TIME(3ossl) OpenSSL X509_CMP_TIME(3ossl)
2
3
4
6 X509_cmp_time, X509_cmp_current_time, X509_cmp_timeframe,
7 X509_time_adj, X509_time_adj_ex - X509 time functions
8
10 int X509_cmp_time(const ASN1_TIME *asn1_time, time_t *in_tm);
11 int X509_cmp_current_time(const ASN1_TIME *asn1_time);
12 int X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm,
13 const ASN1_TIME *start, const ASN1_TIME *end);
14 ASN1_TIME *X509_time_adj(ASN1_TIME *asn1_time, long offset_sec, time_t *in_tm);
15 ASN1_TIME *X509_time_adj_ex(ASN1_TIME *asn1_time, int offset_day, long
16 offset_sec, time_t *in_tm);
17
19 X509_cmp_time() compares the ASN1_TIME in asn1_time with the time in
20 <in_tm>.
21
22 X509_cmp_current_time() compares the ASN1_TIME in asn1_time with the
23 current time, expressed as time_t.
24
25 X509_cmp_timeframe() compares the given time period with the reference
26 time included in the verification parameters vpm if they are not NULL
27 and contain X509_V_FLAG_USE_CHECK_TIME; else the current time is used
28 as reference time.
29
30 X509_time_adj_ex() sets the ASN1_TIME structure asn1_time to the time
31 offset_day and offset_sec after in_tm.
32
33 X509_time_adj() sets the ASN1_TIME structure asn1_time to the time
34 offset_sec after in_tm. This method can only handle second offsets up
35 to the capacity of long, so the newer X509_time_adj_ex() API should be
36 preferred.
37
38 In both methods, if asn1_time is NULL, a new ASN1_TIME structure is
39 allocated and returned.
40
41 In all methods, if in_tm is NULL, the current time, expressed as
42 time_t, is used.
43
44 asn1_time must satisfy the ASN1_TIME format mandated by RFC 5280, i.e.,
45 its format must be either YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ.
46
48 Unlike many standard comparison functions, X509_cmp_time() and
49 X509_cmp_current_time() return 0 on error.
50
52 X509_cmp_time() and X509_cmp_current_time() return -1 if asn1_time is
53 earlier than, or equal to, in_tm (resp. current time), and 1 otherwise.
54 These methods return 0 on error.
55
56 X509_cmp_timeframe() returns 0 if vpm is not NULL and the verification
57 parameters do not contain X509_V_FLAG_USE_CHECK_TIME but do contain
58 X509_V_FLAG_NO_CHECK_TIME. Otherwise it returns 1 if the end time is
59 not NULL and the reference time (which has determined as stated above)
60 is past the end time, -1 if the start time is not NULL and the
61 reference time is before, else 0 to indicate that the reference time is
62 in range (implying that the end time is not before the start time if
63 both are present).
64
65 X509_time_adj() and X509_time_adj_ex() return a pointer to the updated
66 ASN1_TIME structure, and NULL on error.
67
69 X509_cmp_timeframe() was added in OpenSSL 3.0.
70
72 Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
73
74 Licensed under the Apache License 2.0 (the "License"). You may not use
75 this file except in compliance with the License. You can obtain a copy
76 in the file LICENSE in the source distribution or at
77 <https://www.openssl.org/source/license.html>.
78
79
80
813.0.5 2022-07-05 X509_CMP_TIME(3ossl)