2
0

ossl_store.pod 2.3 KB

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