1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
.\" $OpenBSD: X509_get0_notBefore.3,v 1.3 2018/02/25 10:53:16 schwarze Exp $
.\" content checked up to: OpenSSL 27b138e9 May 19 00:16:38 2017 +0000
.\"
.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: February 25 2018 $
.Dt X509_GET0_NOTBEFORE 3
.Os
.Sh NAME
.Nm X509_get0_notBefore ,
.Nm X509_get0_notAfter ,
.Nm X509_getm_notBefore ,
.Nm X509_getm_notAfter ,
.Nm X509_CRL_get0_lastUpdate ,
.Nm X509_CRL_get0_nextUpdate ,
.Nm X509_set1_notBefore ,
.Nm X509_set1_notAfter ,
.Nm X509_CRL_set1_lastUpdate ,
.Nm X509_CRL_set1_nextUpdate
.Nd get and set certificate and CRL validity dates
.Sh SYNOPSIS
.In openssl/x509.h
.Ft const ASN1_TIME *
.Fo X509_get0_notBefore
.Fa "const X509 *x"
.Fc
.Ft const ASN1_TIME *
.Fo X509_get0_notAfter
.Fa "const X509 *x"
.Fc
.Ft ASN1_TIME *
.Fo X509_getm_notBefore
.Fa "const X509 *x"
.Fc
.Ft ASN1_TIME *
.Fo X509_getm_notAfter
.Fa "const X509 *x"
.Fc
.Ft ASN1_TIME *
.Fo X509_CRL_get0_lastUpdate
.Fa "const X509_CRL *crl"
.Fc
.Ft ASN1_TIME *
.Fo X509_CRL_get0_nextUpdate
.Fa "const X509_CRL *crl"
.Fc
.Ft int
.Fo X509_set1_notBefore
.Fa "X509 *x"
.Fa "const ASN1_TIME *tm"
.Fc
.Ft int
.Fo X509_set1_notAfter
.Fa "X509 *x"
.Fa "const ASN1_TIME *tm"
.Fc
.Ft int
.Fo X509_CRL_set1_lastUpdate
.Fa "X509_CRL *crl"
.Fa "const ASN1_TIME *tm"
.Fc
.Ft int
.Fo X509_CRL_set1_nextUpdate
.Fa "X509_CRL *crl"
.Fa "const ASN1_TIME *tm"
.Fc
.Sh DESCRIPTION
.Fn X509_getm_notBefore
and
.Fn X509_getm_notAfter
return pointers to the
.Fa notBefore
and
.Fa notAfter
fields of the validity period of the certificate
.Fa x ,
respectively.
.Pp
.Fn X509_get0_notBefore
and
.Fn X509_get0_notAfter
are identical except for the const qualifier on the return type.
.Pp
.Fn X509_CRL_get0_lastUpdate
and
.Fn X509_CRL_get0_nextUpdate
return pointers to the
.Fa lastUpdate
and
.Fa nextUpdate
fields of
.Fa crl .
.Pp
.Fn X509_set1_notBefore ,
.Fn X509_set1_notAfter ,
.Fn X509_CRL_set1_lastUpdate ,
and
.Fn X509_CRL_set1_nextUpdate
set the
.Fa notBefore ,
.Fa notAfter ,
.Fa lastUpdate ,
or
.Fa nextUpdate
field of
.Fa x
or
.Fa crl ,
respectively, to a deep copy of
.Fa tm
and free the
.Vt ASN1_TIME
value that they replace.
.Sh RETURN VALUES
.Fn X509_get0_notBefore ,
.Fn X509_get0_notAfter ,
.Fn X509_getm_notBefore ,
.Fn X509_getm_notAfter ,
.Fn X509_CRL_get0_lastUpdate ,
and
.Fn X509_CRL_get0_nextUpdate
return internal pointers which must not be freed by the application, or
.Dv NULL
if the requested fields are not available.
.Pp
.Fn X509_set1_notBefore ,
.Fn X509_set1_notAfter ,
.Fn X509_CRL_set1_lastUpdate ,
and
.Fn X509_CRL_set1_nextUpdate
return 1 on success or 0 on failure.
.Sh SEE ALSO
.Xr ASN1_TIME_set 3 ,
.Xr ASN1_TIME_set_tm 3 ,
.Xr X509_cmp_time 3 ,
.Xr X509_CRL_get0_by_serial 3 ,
.Xr X509_CRL_new 3 ,
.Xr X509_get_subject_name 3 ,
.Xr X509_new 3 ,
.Xr X509_sign 3 ,
.Xr X509_VAL_new 3 ,
.Xr X509_verify_cert 3
|