]>
Commit | Line | Data |
---|---|---|
80770da3 EK |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
24053693 EK |
5 | X509_cmp_time, X509_cmp_current_time, X509_time_adj, X509_time_adj_ex |
6 | - X509 time functions | |
80770da3 EK |
7 | |
8 | =head1 SYNOPSIS | |
9 | ||
4ac139b4 EK |
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 | ASN1_TIME *X509_time_adj(ASN1_TIME *asn1_time, long offset_sec, time_t *in_tm); | |
13 | ASN1_TIME *X509_time_adj_ex(ASN1_TIME *asn1_time, int offset_day, long | |
14 | offset_sec, time_t *in_tm); | |
80770da3 EK |
15 | |
16 | =head1 DESCRIPTION | |
17 | ||
4ac139b4 EK |
18 | X509_cmp_time() compares the ASN1_TIME in B<asn1_time> with the time |
19 | in <cmp_time>. X509_cmp_current_time() compares the ASN1_TIME in | |
20 | B<asn1_time> with the current time, expressed as time_t. B<asn1_time> | |
21 | must satisfy the ASN1_TIME format mandated by RFC 5280, i.e., its | |
22 | format must be either YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ. | |
80770da3 | 23 | |
4ac139b4 EK |
24 | X509_time_adj_ex() sets the ASN1_TIME structure B<asn1_time> to the time |
25 | B<offset_day> and B<offset_sec> after B<in_tm>. | |
80770da3 | 26 | |
4ac139b4 EK |
27 | X509_time_adj() sets the ASN1_TIME structure B<asn1_time> to the time |
28 | B<offset_sec> after B<in_tm>. This method can only handle second | |
29 | offsets up to the capacity of long, so the newer X509_time_adj_ex() | |
30 | API should be preferred. | |
31 | ||
32 | In both methods, if B<asn1_time> is NULL, a new ASN1_TIME structure | |
33 | is allocated and returned. | |
34 | ||
35 | In all methods, if B<in_tm> is NULL, the current time, expressed as | |
36 | time_t, is used. | |
80770da3 EK |
37 | |
38 | =head1 BUGS | |
39 | ||
4ac139b4 EK |
40 | Unlike many standard comparison functions, X509_cmp_time() and |
41 | X509_cmp_current_time() return 0 on error. | |
80770da3 EK |
42 | |
43 | =head1 RETURN VALUES | |
44 | ||
4ac139b4 EK |
45 | X509_cmp_time() and X509_cmp_current_time() return -1 if B<asn1_time> |
46 | is earlier than, or equal to, B<cmp_time> (resp. current time), and 1 | |
47 | otherwise. These methods return 0 on error. | |
48 | ||
7f35627c | 49 | X509_time_adj() and X509_time_adj_ex() return a pointer to the updated |
4ac139b4 | 50 | ASN1_TIME structure, and NULL on error. |
80770da3 EK |
51 | |
52 | =head1 COPYRIGHT | |
53 | ||
83cf7abf | 54 | Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. |
80770da3 | 55 | |
4746f25a | 56 | Licensed under the Apache License 2.0 (the "License"). You may not use |
80770da3 EK |
57 | this file except in compliance with the License. You can obtain a copy |
58 | in the file LICENSE in the source distribution or at | |
59 | L<https://www.openssl.org/source/license.html>. | |
60 | ||
61 | =cut |