1PROVIDER-STOREMGMT(7ossl) OpenSSL PROVIDER-STOREMGMT(7ossl)
2
3
4
6 provider-storemgmt - The OSSL_STORE library <-> provider functions
7
9 #include <openssl/core_dispatch.h>
10
11 /*
12 * None of these are actual functions, but are displayed like this for
13 * the function signatures for functions that are offered as function
14 * pointers in OSSL_DISPATCH arrays.
15 */
16
17 void *OSSL_FUNC_store_open(void *provctx, const char *uri);
18 void *OSSL_FUNC_store_attach(void *provctx, OSSL_CORE_BIO *bio);
19 const OSSL_PARAM *store_settable_ctx_params(void *provctx);
20 int OSSL_FUNC_store_set_ctx_params(void *loaderctx, const OSSL_PARAM[]);
21 int OSSL_FUNC_store_load(void *loaderctx,
22 OSSL_CALLBACK *object_cb, void *object_cbarg,
23 OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg);
24 int OSSL_FUNC_store_eof(void *loaderctx);
25 int OSSL_FUNC_store_close(void *loaderctx);
26
27 int OSSL_FUNC_store_export_object
28 (void *loaderctx, const void *objref, size_t objref_sz,
29 OSSL_CALLBACK *export_cb, void *export_cbarg);
30
32 The STORE operation is the provider side of the ossl_store(7) API.
33
34 The primary responsibility of the STORE operation is to load all sorts
35 of objects from a container indicated by URI. These objects are given
36 to the OpenSSL library in provider-native object abstraction form (see
37 provider-object(7)). The OpenSSL library is then responsible for
38 passing on that abstraction to suitable provided functions.
39
40 Examples of functions that the OpenSSL library can pass the abstraction
41 to include OSSL_FUNC_keymgmt_load() (provider-keymgmt(7)),
42 OSSL_FUNC_store_export_object() (which exports the object in
43 parameterized form).
44
45 All "functions" mentioned here are passed as function pointers between
46 libcrypto and the provider in OSSL_DISPATCH arrays via OSSL_ALGORITHM
47 arrays that are returned by the provider's provider_query_operation()
48 function (see "Provider Functions" in provider-base(7)).
49
50 All these "functions" have a corresponding function type definition
51 named OSSL_FUNC_{name}_fn, and a helper function to retrieve the
52 function pointer from a OSSL_DISPATCH element named OSSL_get_{name}.
53 For example, the "function" OSSL_FUNC_store_attach() has these:
54
55 typedef void *(OSSL_FUNC_store_attach_fn)(void *provctx,
56 OSSL_CORE_BIO * bio);
57 static ossl_inline OSSL_FUNC_store_attach_fn
58 OSSL_FUNC_store_attach(const OSSL_DISPATCH *opf);
59
60 OSSL_DISPATCH arrays are indexed by numbers that are provided as macros
61 in openssl-core_dispatch.h(7), as follows:
62
63 OSSL_FUNC_store_open OSSL_FUNC_STORE_OPEN
64 OSSL_FUNC_store_attach OSSL_FUNC_STORE_ATTACH
65 OSSL_FUNC_store_settable_ctx_params OSSL_FUNC_STORE_SETTABLE_CTX_PARAMS
66 OSSL_FUNC_store_set_ctx_params OSSL_FUNC_STORE_SET_CTX_PARAMS
67 OSSL_FUNC_store_load OSSL_FUNC_STORE_LOAD
68 OSSL_FUNC_store_eof OSSL_FUNC_STORE_EOF
69 OSSL_FUNC_store_close OSSL_FUNC_STORE_CLOSE
70 OSSL_FUNC_store_export_object OSSL_FUNC_STORE_EXPORT_OBJECT
71
72 Functions
73 OSSL_FUNC_store_open() should create a provider side context with data
74 based on the input uri. The implementation is entirely responsible for
75 the interpretation of the URI.
76
77 OSSL_FUNC_store_attach() should create a provider side context with the
78 core BIO bio attached. This is an alternative to using a URI to find
79 storage, supporting OSSL_STORE_attach(3).
80
81 OSSL_FUNC_store_settable_ctx_params() should return a constant array of
82 descriptor OSSL_PARAM, for parameters that
83 OSSL_FUNC_store_set_ctx_params() can handle.
84
85 OSSL_FUNC_store_set_ctx_params() should set additional parameters, such
86 as what kind of data to expect, search criteria, and so on. More on
87 those below, in "Load Parameters". Whether unrecognised parameters are
88 an error or simply ignored is at the implementation's discretion.
89 Passing NULL for params should return true.
90
91 OSSL_FUNC_store_load() loads the next object from the URI opened by
92 OSSL_FUNC_store_open(), creates an object abstraction for it (see
93 provider-object(7)), and calls object_cb with it as well as
94 object_cbarg. object_cb will then interpret the object abstraction and
95 do what it can to wrap it or decode it into an OpenSSL structure. In
96 case a passphrase needs to be prompted to unlock an object, pw_cb
97 should be called.
98
99 OSSL_FUNC_store_eof() indicates if the end of the set of objects from
100 the URI has been reached. When that happens, there's no point trying
101 to do any further loading.
102
103 OSSL_FUNC_store_close() frees the provider side context ctx.
104
105 When a provider-native object is created by a store manager it would be
106 unsuitable for direct use with a foreign provider. The export function
107 allows for exporting the object to that foreign provider if the foreign
108 provider supports the type of the object and provides an import
109 function.
110
111 OSSL_FUNC_store_export_object() should export the object of size
112 objref_sz referenced by objref as an OSSL_PARAM array and pass that to
113 the export_cb as well as the given export_cbarg.
114
115 Load Parameters
116 "expect" (OSSL_STORE_PARAM_EXPECT) <integer>
117 Is a hint of what type of data the OpenSSL library expects to get.
118 This is only useful for optimization, as the library will check
119 that the object types match the expectation too.
120
121 The number that can be given through this parameter is found in
122 <openssl/store.h>, with the macros having names starting with
123 "OSSL_STORE_INFO_". These are further described in "SUPPORTED
124 OBJECTS" in OSSL_STORE_INFO(3).
125
126 "subject" (OSSL_STORE_PARAM_SUBJECT) <octet string>
127 Indicates that the caller wants to search for an object with the
128 given subject associated. This can be used to select specific
129 certificates by subject.
130
131 The contents of the octet string is expected to be in DER form.
132
133 "issuer" (OSSL_STORE_PARAM_ISSUER) <octet string>
134 Indicates that the caller wants to search for an object with the
135 given issuer associated. This can be used to select specific
136 certificates by issuer.
137
138 The contents of the octet string is expected to be in DER form.
139
140 "serial" (OSSL_STORE_PARAM_SERIAL) <integer>
141 Indicates that the caller wants to search for an object with the
142 given serial number associated.
143
144 "digest" (OSSL_STORE_PARAM_DIGEST) <UTF8 string>
145 "fingerprint" (OSSL_STORE_PARAM_FINGERPRINT) <octet string>
146 Indicates that the caller wants to search for an object with the
147 given fingerprint, computed with the given digest.
148
149 "alias" (OSSL_STORE_PARAM_ALIAS) <UTF8 string>
150 Indicates that the caller wants to search for an object with the
151 given alias (some call it a "friendly name").
152
153 "properties" (OSSL_STORE_PARAM_PROPERTIES) <utf8 string
154 Property string to use when querying for algorithms such as the
155 OSSL_DECODER decoder implementations.
156
157 "input-type" (OSSL_STORE_PARAM_INPUT_TYPE) <utf8 string
158 Type of the input format as a hint to use when decoding the objects
159 in the store.
160
161 Several of these search criteria may be combined. For example, to
162 search for a certificate by issuer+serial, both the "issuer" and the
163 "serial" parameters will be given.
164
166 provider(7)
167
169 The STORE interface was introduced in OpenSSL 3.0.
170
172 Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
173
174 Licensed under the Apache License 2.0 (the "License"). You may not use
175 this file except in compliance with the License. You can obtain a copy
176 in the file LICENSE in the source distribution or at
177 <https://www.openssl.org/source/license.html>.
178
179
180
1813.0.5 2022-07-05 PROVIDER-STOREMGMT(7ossl)