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