aboutsummaryrefslogtreecommitdiff
path: root/doc/doxyout/hx509/man/man3/hx509_keyset.3
blob: 8a5509271176d20cd31d9432009405f10df5b872 (plain) (blame)
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
.TH "hx509 certificate store functions" 3 "30 Sep 2011" "Version 1.5.1" "Heimdalx509library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
hx509 certificate store functions \- 
.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBhx509_certs_init\fP (hx509_context context, const char *name, int flags, hx509_lock lock, hx509_certs *certs)"
.br
.ti -1c
.RI "int \fBhx509_certs_store\fP (hx509_context context, hx509_certs certs, int flags, hx509_lock lock)"
.br
.ti -1c
.RI "void \fBhx509_certs_free\fP (hx509_certs *certs)"
.br
.ti -1c
.RI "int \fBhx509_certs_start_seq\fP (hx509_context context, hx509_certs certs, hx509_cursor *cursor)"
.br
.ti -1c
.RI "int \fBhx509_certs_next_cert\fP (hx509_context context, hx509_certs certs, hx509_cursor cursor, hx509_cert *cert)"
.br
.ti -1c
.RI "int \fBhx509_certs_end_seq\fP (hx509_context context, hx509_certs certs, hx509_cursor cursor)"
.br
.ti -1c
.RI "int \fBhx509_certs_iter_f\fP (hx509_context context, hx509_certs certs, int(*func)(hx509_context, void *, hx509_cert), void *ctx)"
.br
.ti -1c
.RI "int \fBhx509_ci_print_names\fP (hx509_context context, void *ctx, hx509_cert c)"
.br
.ti -1c
.RI "int \fBhx509_certs_add\fP (hx509_context context, hx509_certs certs, hx509_cert cert)"
.br
.ti -1c
.RI "int \fBhx509_certs_find\fP (hx509_context context, hx509_certs certs, const hx509_query *q, hx509_cert *r)"
.br
.ti -1c
.RI "int \fBhx509_certs_filter\fP (hx509_context context, hx509_certs certs, const hx509_query *q, hx509_certs *result)"
.br
.ti -1c
.RI "int \fBhx509_certs_merge\fP (hx509_context context, hx509_certs to, hx509_certs from)"
.br
.ti -1c
.RI "int \fBhx509_certs_append\fP (hx509_context context, hx509_certs to, hx509_lock lock, const char *name)"
.br
.ti -1c
.RI "int \fBhx509_get_one_cert\fP (hx509_context context, hx509_certs certs, hx509_cert *c)"
.br
.ti -1c
.RI "int \fBhx509_certs_info\fP (hx509_context context, hx509_certs certs, int(*func)(void *, const char *), void *ctx)"
.br
.in -1c
.SH "Detailed Description"
.PP 
See the \fBCertificate store operations\fP for description and examples. 
.SH "Function Documentation"
.PP 
.SS "int hx509_certs_add (hx509_context context, hx509_certs certs, hx509_cert cert)"
.PP
Add a certificate to the certificiate store.
.PP
The receiving keyset certs will either increase reference counter of the cert or make a deep copy, either way, the caller needs to free the cert itself.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to add the certificate to. 
.br
\fIcert\fP certificate to add.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_certs_append (hx509_context context, hx509_certs to, hx509_lock lock, const char * name)"
.PP
Same a \fBhx509_certs_merge()\fP but use a lock and name to describe the from source.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIto\fP the store to merge into. 
.br
\fIlock\fP a lock that unlocks the certificates store, use NULL to select no password/certifictes/prompt lock (see \fBLocking and unlocking certificates and encrypted data.\fP). 
.br
\fIname\fP name of the source store
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_certs_end_seq (hx509_context context, hx509_certs certs, hx509_cursor cursor)"
.PP
End the iteration over certificates.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to iterate over. 
.br
\fIcursor\fP cursor that will keep track of progress, freed.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_certs_filter (hx509_context context, hx509_certs certs, const hx509_query * q, hx509_certs * result)"
.PP
Filter certificate matching the query.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to search. 
.br
\fIq\fP query allocated with \fBhx509 query functions\fP functions. 
.br
\fIresult\fP the filtered certificate store, caller must free with \fBhx509_certs_free()\fP.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.PP
Return HX509_CERT_NOT_FOUND if no certificate in certs matched the query. 
.SS "int hx509_certs_find (hx509_context context, hx509_certs certs, const hx509_query * q, hx509_cert * r)"
.PP
Find a certificate matching the query.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to search. 
.br
\fIq\fP query allocated with \fBhx509 query functions\fP functions. 
.br
\fIr\fP return certificate (or NULL on error), should be freed with \fBhx509_cert_free()\fP.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.PP
Return HX509_CERT_NOT_FOUND if no certificate in certs matched the query. 
.SS "void hx509_certs_free (hx509_certs * certs)"
.PP
Free a certificate store.
.PP
\fBParameters:\fP
.RS 4
\fIcerts\fP certificate store to free. 
.RE
.PP

.SS "int hx509_certs_info (hx509_context context, hx509_certs certs, int(*)(void *, const char *) func, void * ctx)"
.PP
Print some info about the certificate store.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to print information about. 
.br
\fIfunc\fP function that will get each line of the information, if NULL is used the data is printed on a FILE descriptor that should be passed in ctx, if ctx also is NULL, stdout is used. 
.br
\fIctx\fP parameter to func.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_certs_init (hx509_context context, const char * name, int flags, hx509_lock lock, hx509_certs * certs)"
.PP
Open or creates a new hx509 certificate store.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP A hx509 context 
.br
\fIname\fP name of the store, format is TYPE:type-specific-string, if NULL is used the MEMORY store is used. 
.br
\fIflags\fP list of flags:
.IP "\(bu" 2
HX509_CERTS_CREATE create a new keystore of the specific TYPE.
.IP "\(bu" 2
HX509_CERTS_UNPROTECT_ALL fails if any private key failed to be extracted. 
.PP
.br
\fIlock\fP a lock that unlocks the certificates store, use NULL to select no password/certifictes/prompt lock (see \fBLocking and unlocking certificates and encrypted data.\fP). 
.br
\fIcerts\fP return pointer, free with \fBhx509_certs_free()\fP. 
.RE
.PP

.SS "int hx509_certs_iter_f (hx509_context context, hx509_certs certs, int(*)(hx509_context, void *, hx509_cert) func, void * ctx)"
.PP
Iterate over all certificates in a keystore and call an function for each fo them.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to iterate over. 
.br
\fIfunc\fP function to call for each certificate. The function should return non-zero to abort the iteration, that value is passed back to the caller of \fBhx509_certs_iter_f()\fP. 
.br
\fIctx\fP context variable that will passed to the function.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_certs_merge (hx509_context context, hx509_certs to, hx509_certs from)"
.PP
Merge a certificate store into another. The from store is keep intact.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIto\fP the store to merge into. 
.br
\fIfrom\fP the store to copy the object from.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_certs_next_cert (hx509_context context, hx509_certs certs, hx509_cursor cursor, hx509_cert * cert)"
.PP
Get next ceritificate from the certificate keystore pointed out by cursor.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to iterate over. 
.br
\fIcursor\fP cursor that keeps track of progress. 
.br
\fIcert\fP return certificate next in store, NULL if the store contains no more certificates. Free with \fBhx509_cert_free()\fP.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_certs_start_seq (hx509_context context, hx509_certs certs, hx509_cursor * cursor)"
.PP
Start the integration
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to iterate over 
.br
\fIcursor\fP cursor that will keep track of progress, free with \fBhx509_certs_end_seq()\fP.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. HX509_UNSUPPORTED_OPERATION is returned if the certificate store doesn't support the iteration operation. 
.RE
.PP

.SS "int hx509_certs_store (hx509_context context, hx509_certs certs, int flags, hx509_lock lock)"
.PP
Write the certificate store to stable storage.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP A hx509 context. 
.br
\fIcerts\fP a certificate store to store. 
.br
\fIflags\fP currently unused, use 0. 
.br
\fIlock\fP a lock that unlocks the certificates store, use NULL to select no password/certifictes/prompt lock (see \fBLocking and unlocking certificates and encrypted data.\fP).
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. HX509_UNSUPPORTED_OPERATION if the certificate store doesn't support the store operation. 
.RE
.PP

.SS "int hx509_ci_print_names (hx509_context context, void * ctx, hx509_cert c)"
.PP
Iterate over all certificates in a keystore and call an function for each fo them.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP certificate store to iterate over. 
.br
\fIfunc\fP function to call for each certificate. The function should return non-zero to abort the iteration, that value is passed back to the caller of hx509_certs_iter().
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. Function to use to \fBhx509_certs_iter_f()\fP as a function argument, the ctx variable to \fBhx509_certs_iter_f()\fP should be a FILE file descriptor.
.RE
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIctx\fP used by \fBhx509_certs_iter_f()\fP. 
.br
\fIc\fP a certificate
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP

.SS "int hx509_get_one_cert (hx509_context context, hx509_certs certs, hx509_cert * c)"
.PP
Get one random certificate from the certificate store.
.PP
\fBParameters:\fP
.RS 4
\fIcontext\fP a hx509 context. 
.br
\fIcerts\fP a certificate store to get the certificate from. 
.br
\fIc\fP return certificate, should be freed with \fBhx509_cert_free()\fP.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns an hx509 error code. 
.RE
.PP