1=pod
2
3=head1 NAME
4
5OSSL_STORE_INFO, OSSL_STORE_INFO_get_type, OSSL_STORE_INFO_get0_NAME,
6OSSL_STORE_INFO_get0_NAME_description,
7OSSL_STORE_INFO_get0_PARAMS, OSSL_STORE_INFO_get0_PUBKEY,
8OSSL_STORE_INFO_get0_PKEY, OSSL_STORE_INFO_get0_CERT, OSSL_STORE_INFO_get0_CRL,
9OSSL_STORE_INFO_get1_NAME, OSSL_STORE_INFO_get1_NAME_description,
10OSSL_STORE_INFO_get1_PARAMS, OSSL_STORE_INFO_get1_PUBKEY,
11OSSL_STORE_INFO_get1_PKEY, OSSL_STORE_INFO_get1_CERT, OSSL_STORE_INFO_get1_CRL,
12OSSL_STORE_INFO_type_string, OSSL_STORE_INFO_free,
13OSSL_STORE_INFO_new_NAME, OSSL_STORE_INFO_set0_NAME_description,
14OSSL_STORE_INFO_new_PARAMS, OSSL_STORE_INFO_new_PUBKEY,
15OSSL_STORE_INFO_new_PKEY, OSSL_STORE_INFO_new_CERT, OSSL_STORE_INFO_new_CRL,
16OSSL_STORE_INFO_new, OSSL_STORE_INFO_get0_data
17- Functions to manipulate OSSL_STORE_INFO objects
18
19=head1 SYNOPSIS
20
21 #include <openssl/store.h>
22
23 typedef struct ossl_store_info_st OSSL_STORE_INFO;
24
25 int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *store_info);
26 const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *store_info);
27 char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *store_info);
28 const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO
29                                                   *store_info);
30 char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *store_info);
31 EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *store_info);
32 EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *store_info);
33 EVP_PKEY *OSSL_STORE_INFO_get0_PUBKEY(const OSSL_STORE_INFO *info);
34 EVP_PKEY *OSSL_STORE_INFO_get1_PUBKEY(const OSSL_STORE_INFO *info);
35 EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *store_info);
36 EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *store_info);
37 X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *store_info);
38 X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *store_info);
39 X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *store_info);
40 X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *store_info);
41
42 const char *OSSL_STORE_INFO_type_string(int type);
43
44 void OSSL_STORE_INFO_free(OSSL_STORE_INFO *store_info);
45
46 OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name);
47 int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc);
48 OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(DSA *dsa_params);
49 OSSL_STORE_INFO *OSSL_STORE_INFO_new_PUBKEY(EVP_PKEY *pubkey);
50 OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey);
51 OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509);
52 OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl);
53
54 OSSL_STORE_INFO *OSSL_STORE_INFO_new(int type, void *data);
55 void *OSSL_STORE_INFO_get0_data(int type, const OSSL_STORE_INFO *info);
56
57=head1 DESCRIPTION
58
59These functions are primarily useful for applications to retrieve
60supported objects from B<OSSL_STORE_INFO> objects and for scheme specific
61loaders to create B<OSSL_STORE_INFO> holders.
62
63=head2 Types
64
65B<OSSL_STORE_INFO> is an opaque type that's just an intermediary holder for
66the objects that have been retrieved by OSSL_STORE_load() and similar functions.
67Supported OpenSSL type object can be extracted using one of
68STORE_INFO_get0_<TYPE>() where <TYPE> can be NAME, PARAMS, PKEY, CERT, or CRL.
69The life time of this extracted object is as long as the life time of
70the B<OSSL_STORE_INFO> it was extracted from, so care should be taken not
71to free the latter too early.
72As an alternative, STORE_INFO_get1_<TYPE>() extracts a duplicate (or the
73same object with its reference count increased), which can be used
74after the containing B<OSSL_STORE_INFO> has been freed.
75The object returned by STORE_INFO_get1_<TYPE>() must be freed separately
76by the caller.
77See L</SUPPORTED OBJECTS> for more information on the types that are supported.
78
79=head2 Functions
80
81OSSL_STORE_INFO_get_type() takes a B<OSSL_STORE_INFO> and returns the STORE
82type number for the object inside.
83
84STORE_INFO_get_type_string() takes a STORE type number and returns a
85short string describing it.
86
87OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(),
88OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PUBKEY(),
89OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(),
90OSSL_STORE_INFO_get0_CRL()
91all take a B<OSSL_STORE_INFO> and return the object it holds if the
92B<OSSL_STORE_INFO> type (as returned by OSSL_STORE_INFO_get_type())
93matches the function, otherwise NULL.
94
95OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(),
96OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PUBKEY(),
97OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT() and
98OSSL_STORE_INFO_get1_CRL()
99all take a B<OSSL_STORE_INFO> and return a duplicate the object it
100holds if the B<OSSL_STORE_INFO> type (as returned by
101OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL.
102
103OSSL_STORE_INFO_free() frees a B<OSSL_STORE_INFO> and its contained type.
104
105OSSL_STORE_INFO_new_NAME() , OSSL_STORE_INFO_new_PARAMS(),
106, OSSL_STORE_INFO_new_PUBKEY(), OSSL_STORE_INFO_new_PKEY(),
107OSSL_STORE_INFO_new_CERT() and OSSL_STORE_INFO_new_CRL()
108create a B<OSSL_STORE_INFO> object to hold the given input object.
109On success the input object is consumed.
110
111Additionally, for B<OSSL_STORE_INFO_NAME> objects,
112OSSL_STORE_INFO_set0_NAME_description() can be used to add an extra
113description.
114This description is meant to be human readable and should be used for
115information printout.
116
117OSSL_STORE_INFO_new() creates a B<OSSL_STORE_INFO> with an arbitrary I<type>
118number and I<data> structure.  It's the responsibility of the caller to
119define type numbers other than the ones defined by F<< <openssl/store.h> >>,
120and to handle freeing the associated data structure on their own.
121I<Using type numbers that are defined by F<< <openssl/store.h> >> may cause
122undefined behaviours, including crashes>.
123
124OSSL_STORE_INFO_get0_data() returns the data pointer that was passed to
125OSSL_STORE_INFO_new() if I<type> matches the type number in I<info>.
126
127OSSL_STORE_INFO_new() and OSSL_STORE_INFO_get0_data() may be useful for
128applications that define their own STORE data, but must be used with care.
129
130=head1 SUPPORTED OBJECTS
131
132Currently supported object types are:
133
134=over 4
135
136=item OSSL_STORE_INFO_NAME
137
138A name is exactly that, a name.
139It's like a name in a directory, but formatted as a complete URI.
140For example, the path in URI C<file:/foo/bar/> could include a file
141named C<cookie.pem>, and in that case, the returned B<OSSL_STORE_INFO_NAME>
142object would have the URI C<file:/foo/bar/cookie.pem>, which can be
143used by the application to get the objects in that file.
144This can be applied to all schemes that can somehow support a listing
145of object URIs.
146
147For C<file:> URIs that are used without the explicit scheme, the
148returned name will be the path of each object, so if C</foo/bar> was
149given and that path has the file C<cookie.pem>, the name
150C</foo/bar/cookie.pem> will be returned.
151
152The returned URI is considered canonical and must be unique and permanent
153for the storage where the object (or collection of objects) resides.
154Each loader is responsible for ensuring that it only returns canonical
155URIs.
156However, it's possible that certain schemes allow an object (or collection
157thereof) to be reached with alternative URIs; just because one URI is
158canonical doesn't mean that other variants can't be used.
159
160At the discretion of the loader that was used to get these names, an
161extra description may be attached as well.
162
163=item OSSL_STORE_INFO_PARAMS
164
165Key parameters.
166
167=item OSSL_STORE_INFO_PKEY
168
169A keypair or just a private key (possibly with key parameters).
170
171=item OSSL_STORE_INFO_PUBKEY
172
173A public key (possibly with key parameters).
174
175=item OSSL_STORE_INFO_CERT
176
177An X.509 certificate.
178
179=item OSSL_STORE_INFO_CRL
180
181A X.509 certificate revocation list.
182
183=back
184
185=head1 RETURN VALUES
186
187OSSL_STORE_INFO_get_type() returns the STORE type number of the given
188B<OSSL_STORE_INFO>.
189There is no error value.
190
191OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(),
192OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PKEY(),
193OSSL_STORE_INFO_get0_CERT() and OSSL_STORE_INFO_get0_CRL() all return
194a pointer to the OpenSSL object on success, NULL otherwise.
195
196OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(),
197OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PKEY(),
198OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all return
199a pointer to a duplicate of the OpenSSL object on success, NULL otherwise.
200
201OSSL_STORE_INFO_type_string() returns a string on success, or NULL on
202failure.
203
204OSSL_STORE_INFO_new_NAME(), OSSL_STORE_INFO_new_PARAMS(),
205OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and
206OSSL_STORE_INFO_new_CRL() return a B<OSSL_STORE_INFO>
207pointer on success, or NULL on failure.
208
209OSSL_STORE_INFO_set0_NAME_description() returns 1 on success, or 0 on
210failure.
211
212=head1 SEE ALSO
213
214L<ossl_store(7)>, L<OSSL_STORE_open(3)>, L<OSSL_STORE_register_loader(3)>
215
216=head1 HISTORY
217
218The OSSL_STORE API was added in OpenSSL 1.1.1.
219
220The OSSL_STORE_INFO_PUBKEY object type was added in OpenSSL 3.0.
221
222=head1 COPYRIGHT
223
224Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
225
226Licensed under the Apache License 2.0 (the "License").  You may not use
227this file except in compliance with the License.  You can obtain a copy
228in the file LICENSE in the source distribution or at
229L<https://www.openssl.org/source/license.html>.
230
231=cut
232