1OSSL_STORE(7ossl) OpenSSL OSSL_STORE(7ossl)
2
3
4
6 ossl_store - Store retrieval functions
7
9 #include <openssl/store.h>
10
12 General
13 A STORE is a layer of functionality to retrieve a number of supported
14 objects from a repository of any kind, addressable as a filename or as
15 a URI.
16
17 The functionality supports the pattern "open a channel to the
18 repository", "loop and retrieve one object at a time", and "finish up
19 by closing the channel".
20
21 The retrieved objects are returned as a wrapper type OSSL_STORE_INFO,
22 from which an OpenSSL type can be retrieved.
23
24 URI schemes and loaders
25 Support for a URI scheme is called a STORE "loader", and can be added
26 dynamically from the calling application or from a loadable engine.
27
28 Support for the 'file' scheme is built into "libcrypto". See
29 ossl_store-file(7) for more information.
30
31 UI_METHOD and pass phrases
32 The OSS_STORE API does nothing to enforce any specific format or
33 encoding on the pass phrase that the UI_METHOD provides. However, the
34 pass phrase is expected to be UTF-8 encoded. The result of any other
35 encoding is undefined.
36
38 A generic call
39 OSSL_STORE_CTX *ctx = OSSL_STORE_open("file:/foo/bar/data.pem");
40
41 /*
42 * OSSL_STORE_eof() simulates file semantics for any repository to signal
43 * that no more data can be expected
44 */
45 while (!OSSL_STORE_eof(ctx)) {
46 OSSL_STORE_INFO *info = OSSL_STORE_load(ctx);
47
48 /*
49 * Do whatever is necessary with the OSSL_STORE_INFO,
50 * here just one example
51 */
52 switch (OSSL_STORE_INFO_get_type(info)) {
53 case OSSL_STORE_INFO_CERT:
54 /* Print the X.509 certificate text */
55 X509_print_fp(stdout, OSSL_STORE_INFO_get0_CERT(info));
56 /* Print the X.509 certificate PEM output */
57 PEM_write_X509(stdout, OSSL_STORE_INFO_get0_CERT(info));
58 break;
59 }
60 }
61
62 OSSL_STORE_close(ctx);
63
65 OSSL_STORE_INFO(3), OSSL_STORE_LOADER(3), OSSL_STORE_open(3),
66 OSSL_STORE_expect(3), OSSL_STORE_SEARCH(3)
67
69 Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
70
71 Licensed under the Apache License 2.0 (the "License"). You may not use
72 this file except in compliance with the License. You can obtain a copy
73 in the file LICENSE in the source distribution or at
74 <https://www.openssl.org/source/license.html>.
75
76
77
783.0.5 2022-11-01 OSSL_STORE(7ossl)