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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
.\" $OpenBSD: X509_STORE_set1_param.3,v 1.15 2018/04/02 01:35:37 schwarze Exp $
.\" content checked up to:
.\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000
.\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400
.\"
.\" 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: April 2 2018 $
.Dt X509_STORE_SET1_PARAM 3
.Os
.Sh NAME
.Nm X509_STORE_set1_param ,
.Nm X509_STORE_set_flags ,
.Nm X509_STORE_set_purpose ,
.Nm X509_STORE_set_trust ,
.Nm X509_STORE_set_depth ,
.Nm X509_STORE_add_cert ,
.Nm X509_STORE_add_crl ,
.Nm X509_STORE_get0_param ,
.Nm X509_STORE_get0_objects ,
.Nm X509_STORE_get_ex_new_index ,
.Nm X509_STORE_set_ex_data ,
.Nm X509_STORE_get_ex_data
.Nd get and set X509_STORE data
.Sh SYNOPSIS
.In openssl/x509_vfy.h
.Ft int
.Fo X509_STORE_set1_param
.Fa "X509_STORE *store"
.Fa "X509_VERIFY_PARAM *pm"
.Fc
.Ft int
.Fo X509_STORE_set_flags
.Fa "X509_STORE *store"
.Fa "unsigned long flags"
.Fc
.Ft int
.Fo X509_STORE_set_purpose
.Fa "X509_STORE *store"
.Fa "int purpose"
.Fc
.Ft int
.Fo X509_STORE_set_trust
.Fa "X509_STORE *store"
.Fa "int trust"
.Fc
.Ft int
.Fo X509_STORE_set_depth
.Fa "X509_STORE *store"
.Fa "int depth"
.Fc
.Ft int
.Fo X509_STORE_add_cert
.Fa "X509_STORE *store"
.Fa "X509 *x"
.Fc
.Ft int
.Fo X509_STORE_add_crl
.Fa "X509_STORE *store"
.Fa "X509_CRL *crl"
.Fc
.Ft X509_VERIFY_PARAM *
.Fo X509_STORE_get0_param
.Fa "X509_STORE *store"
.Fc
.Ft STACK_OF(X509_OBJECT) *
.Fo X509_STORE_get0_objects
.Fa "X509_STORE *store"
.Fc
.Ft int
.Fo X509_STORE_get_ex_new_index
.Fa "long argl"
.Fa "void *argp"
.Fa "CRYPTO_EX_new *new_func"
.Fa "CRYPTO_EX_dup *dup_func"
.Fa "CRYPTO_EX_free *free_func"
.Fc
.Ft int
.Fo X509_STORE_set_ex_data
.Fa "X509_STORE *store"
.Fa "int idx"
.Fa "void *arg"
.Fc
.Ft void *
.Fo X509_STORE_get_ex_data
.Fa "X509_STORE *store"
.Fa "int idx"
.Fc
.Sh DESCRIPTION
.Fn X509_STORE_set1_param
copies the verification parameters from
.Fa pm
into the verification parameter object contained in the
.Fa store .
.Pp
.Fn X509_VERIFY_PARAM_set_flags ,
.Fn X509_STORE_set_purpose ,
.Fn X509_STORE_set_trust ,
and
.Fn X509_STORE_set_depth
call
.Fn X509_VERIFY_PARAM_set_flags ,
.Fn X509_VERIFY_PARAM_set_purpose ,
.Fn X509_VERIFY_PARAM_set_trust ,
and
.Fn X509_VERIFY_PARAM_set_depth
on the verification parameter object contained in the
.Fa store .
.Pp
.Fn X509_STORE_add_cert
and
.Fn X509_STORE_add_crl
add the certificate
.Fa x
or the certificate revocation list
.Fa crl
to the
.Fa store ,
increasing its reference count by 1 in case of success.
Untrusted objects should not be added in this way.
.Pp
.Fn X509_STORE_get_ex_new_index ,
.Fn X509_STORE_set_ex_data ,
and
.Fn X509_STORE_get_ex_data
handle application specific data in
.Vt X509_STORE
objects.
Their usage is identical to that of
.Xr RSA_get_ex_new_index 3 ,
.Xr RSA_set_ex_data 3 ,
and
.Xr RSA_get_ex_data 3 .
.Sh RETURN VALUES
.Fn X509_STORE_set1_param ,
.Fn X509_STORE_set_purpose ,
.Fn X509_STORE_set_trust ,
and
.Fn X509_STORE_set_ex_data
return 1 for success or 0 for failure.
.Pp
.Fn X509_STORE_set_flags
and
.Fn X509_STORE_set_depth
always return 1, indicating success.
.Pp
.Fn X509_STORE_add_cert
and
.Fn X509_STORE_add_crl
return 1 for success or 0 for failure.
For example, they fail if
.Fa x
or
.Fa crl
is a
.Dv NULL
pointer, if a certificate with the same subject name as
.Fa x
or a revocation list with the same issuer name as
.Fa crl
are already contained in the
.Fa store ,
or if memory allocation fails.
.Pp
.Fn X509_STORE_get0_param
returns an internal pointer to the verification parameter object
contained in the
.Fa store ,
.Fn X509_STORE_get0_objects
to the stack of certificates, revocation lists, and private keys.
The returned pointers must not be freed by the calling application.
.Pp
.Fn X509_STORE_get_ex_new_index
returns a new index or \-1 on failure.
.Pp
.Fn X509_STORE_get_ex_data
returns the application data or
.Dv NULL
on failure.
.Sh SEE ALSO
.Xr SSL_set1_param 3 ,
.Xr X509_OBJECT_get0_X509 3 ,
.Xr X509_STORE_CTX_set0_param 3 ,
.Xr X509_STORE_load_locations 3 ,
.Xr X509_STORE_new 3 ,
.Xr X509_VERIFY_PARAM_set_flags 3
.Sh HISTORY
.Fn X509_STORE_add_cert
first appeared in SSLeay 0.8.0.
.Fn X509_STORE_add_crl
first appeared in SSLeay 0.9.0.
These functions have been available since
.Ox 2.4 .
.Pp
.Fn X509_STORE_set_flags ,
.Fn X509_STORE_set_purpose ,
and
.Fn X509_STORE_set_trust
first appeared in OpenSSL 0.9.7 and have been available since
.Ox 3.2 .
.Pp
.Fn X509_STORE_set1_param
and
.Fn X509_STORE_set_depth
first appeared in OpenSSL 0.9.8 and have been available since
.Ox 4.5 .
.Pp
.Fn X509_STORE_get0_param ,
.Fn X509_STORE_get0_objects ,
.Fn X509_STORE_get_ex_new_index ,
.Fn X509_STORE_set_ex_data ,
and
.Fn X509_STORE_get_ex_data
first appeared in OpenSSL 1.1.0 and have been available since
.Ox 6.3 .
|