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