xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/X509_cmp_time.pod (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos=pod
2*4724848cSchristos
3*4724848cSchristos=head1 NAME
4*4724848cSchristos
5*4724848cSchristosX509_cmp_time, X509_cmp_current_time, X509_time_adj, X509_time_adj_ex
6*4724848cSchristos- X509 time functions
7*4724848cSchristos
8*4724848cSchristos=head1 SYNOPSIS
9*4724848cSchristos
10*4724848cSchristos int X509_cmp_time(const ASN1_TIME *asn1_time, time_t *in_tm);
11*4724848cSchristos int X509_cmp_current_time(const ASN1_TIME *asn1_time);
12*4724848cSchristos ASN1_TIME *X509_time_adj(ASN1_TIME *asn1_time, long offset_sec, time_t *in_tm);
13*4724848cSchristos ASN1_TIME *X509_time_adj_ex(ASN1_TIME *asn1_time, int offset_day, long
14*4724848cSchristos                             offset_sec, time_t *in_tm);
15*4724848cSchristos
16*4724848cSchristos=head1 DESCRIPTION
17*4724848cSchristos
18*4724848cSchristosX509_cmp_time() compares the ASN1_TIME in B<asn1_time> with the time
19*4724848cSchristosin <cmp_time>. X509_cmp_current_time() compares the ASN1_TIME in
20*4724848cSchristosB<asn1_time> with the current time, expressed as time_t. B<asn1_time>
21*4724848cSchristosmust satisfy the ASN1_TIME format mandated by RFC 5280, i.e., its
22*4724848cSchristosformat must be either YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ.
23*4724848cSchristos
24*4724848cSchristosX509_time_adj_ex() sets the ASN1_TIME structure B<asn1_time> to the time
25*4724848cSchristosB<offset_day> and B<offset_sec> after B<in_tm>.
26*4724848cSchristos
27*4724848cSchristosX509_time_adj() sets the ASN1_TIME structure B<asn1_time> to the time
28*4724848cSchristosB<offset_sec> after B<in_tm>. This method can only handle second
29*4724848cSchristosoffsets up to the capacity of long, so the newer X509_time_adj_ex()
30*4724848cSchristosAPI should be preferred.
31*4724848cSchristos
32*4724848cSchristosIn both methods, if B<asn1_time> is NULL, a new ASN1_TIME structure
33*4724848cSchristosis allocated and returned.
34*4724848cSchristos
35*4724848cSchristosIn all methods, if B<in_tm> is NULL, the current time, expressed as
36*4724848cSchristostime_t, is used.
37*4724848cSchristos
38*4724848cSchristos=head1 BUGS
39*4724848cSchristos
40*4724848cSchristosUnlike many standard comparison functions, X509_cmp_time() and
41*4724848cSchristosX509_cmp_current_time() return 0 on error.
42*4724848cSchristos
43*4724848cSchristos=head1 RETURN VALUES
44*4724848cSchristos
45*4724848cSchristosX509_cmp_time() and X509_cmp_current_time() return -1 if B<asn1_time>
46*4724848cSchristosis earlier than, or equal to, B<cmp_time> (resp. current time), and 1
47*4724848cSchristosotherwise. These methods return 0 on error.
48*4724848cSchristos
49*4724848cSchristosX509_time_adj() and X509_time_adj_ex() return a pointer to the updated
50*4724848cSchristosASN1_TIME structure, and NULL on error.
51*4724848cSchristos
52*4724848cSchristos=head1 COPYRIGHT
53*4724848cSchristos
54*4724848cSchristosCopyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
55*4724848cSchristos
56*4724848cSchristosLicensed under the OpenSSL license (the "License").  You may not use
57*4724848cSchristosthis file except in compliance with the License.  You can obtain a copy
58*4724848cSchristosin the file LICENSE in the source distribution or at
59*4724848cSchristosL<https://www.openssl.org/source/license.html>.
60*4724848cSchristos
61*4724848cSchristos=cut
62