5 ossl_store - Store retrieval functions
11 #include <openssl/store.h>
17 A STORE is a layer of functionality to retrieve a number of supported
18 objects from a repository of any kind, addressable as a file name or
21 The functionality supports the pattern "open a channel to the
22 repository", "loop and retrieve one object at a time", and "finish up
23 by closing the channel".
25 The retrieved objects are returned as a wrapper type B<OSSL_STORE_INFO>,
26 from which an OpenSSL type can be retrieved.
28 =head2 URI schemes and loaders
30 Support for a URI scheme is called a STORE "loader", and can be added
31 dynamically from the calling application or from a loadable engine.
33 Support for the 'file' scheme is built into C<libcrypto>.
34 See L<ossl_store-file(7)> for more information.
36 =head2 UI_METHOD and pass phrases
38 The B<OSS_STORE> API does nothing to enforce any specific format or
39 encoding on the pass phrase that the B<UI_METHOD> provides. However,
40 the pass phrase is expected to be UTF-8 encoded. The result of any
41 other encoding is undefined.
47 OSSL_STORE_CTX *ctx = OSSL_STORE_open("file:/foo/bar/data.pem");
50 * OSSL_STORE_eof() simulates file semantics for any repository to signal
51 * that no more data can be expected
53 while (!OSSL_STORE_eof(ctx)) {
54 OSSL_STORE_INFO *info = OSSL_STORE_load(ctx);
57 * Do whatever is necessary with the OSSL_STORE_INFO,
58 * here just one example
60 switch (OSSL_STORE_INFO_get_type(info)) {
61 case OSSL_STORE_INFO_X509:
62 /* Print the X.509 certificate text */
63 X509_print_fp(stdout, OSSL_STORE_INFO_get0_CERT(info));
64 /* Print the X.509 certificate PEM output */
65 PEM_write_X509(stdout, OSSL_STORE_INFO_get0_CERT(info));
70 OSSL_STORE_close(ctx);
74 L<OSSL_STORE_INFO(3)>, L<OSSL_STORE_LOADER(3)>,
75 L<OSSL_STORE_open(3)>, L<OSSL_STORE_expect(3)>,
76 L<OSSL_STORE_SEARCH(3)>
80 Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
82 Licensed under the OpenSSL license (the "License"). You may not use
83 this file except in compliance with the License. You can obtain a copy
84 in the file LICENSE in the source distribution or at
85 L<https://www.openssl.org/source/license.html>.