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