ef97ec85c4b94ead89ef58bec915d8c56ab3d75b
[openssl.git] / doc / man3 / OSSL_STORE_expect.pod
1 =pod
2
3 =head1 NAME
4
5 OSSL_STORE_expect - Specify what object type is expected
6
7 =head1 SYNOPSIS
8
9  #include <openssl/store.h>
10
11  int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type);
12
13 =head1 DESCRIPTION
14
15 OSSL_STORE_expect() helps applications filter what OSSL_STORE_load() returns
16 by specifying a B<OSSL_STORE_INFO> type.
17 For example, if C<file:/foo/bar/store.pem> contains several different objects
18 and only the certificates are interesting, the application can simply say
19 that it expects the type B<OSSL_STORE_INFO_CERT>.
20 All known object types (see L<OSSL_STORE_INFO(3)/SUPPORTED OBJECTS>)
21 except for B<OSSL_STORE_INFO_NAME> are supported.
22
23 OSSL_STORE_expect() I<must> be called before the first OSSL_STORE_load()
24 of a given session, or it will fail.
25
26 =head1 NOTES
27
28 If a more elaborate filter is required by the application, a better choice
29 would be to use a post-processing function.
30 See L<OSSL_STORE_open(3)> for more information.
31
32 However, some loaders may take advantage of the knowledge of an expected type
33 to make object retrieval more efficient, so if a single type is expected, this
34 method is usually preferable.
35
36 =head1 RETURN VALUES
37
38 OSSL_STORE_expect() returns 1 on success, or 0 on failure.
39
40 =head1 SEE ALSO
41
42 L<ossl_store(7)>, L<OSSL_STORE_INFO(3)>, L<OSSL_STORE_load(3)>
43
44 =head1 HISTORY
45
46 OSSL_STORE_expect()
47 was added to OpenSSL 1.1.1.
48
49 =head1 COPYRIGHT
50
51 Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
52
53 Licensed under the OpenSSL license (the "License").  You may not use
54 this file except in compliance with the License.  You can obtain a copy
55 in the file LICENSE in the source distribution or at
56 L<https://www.openssl.org/source/license.html>.
57
58 =cut