OSSL_STORE_INFO.pod 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. =pod
  2. =head1 NAME
  3. OSSL_STORE_INFO, OSSL_STORE_INFO_get_type, OSSL_STORE_INFO_get0_NAME,
  4. OSSL_STORE_INFO_get0_NAME_description, OSSL_STORE_INFO_get0_PARAMS,
  5. OSSL_STORE_INFO_get0_PKEY, OSSL_STORE_INFO_get0_CERT, OSSL_STORE_INFO_get0_CRL,
  6. OSSL_STORE_INFO_get1_NAME, OSSL_STORE_INFO_get1_NAME_description,
  7. OSSL_STORE_INFO_get1_PARAMS, OSSL_STORE_INFO_get1_PKEY,
  8. OSSL_STORE_INFO_get1_CERT,
  9. OSSL_STORE_INFO_get1_CRL, OSSL_STORE_INFO_type_string, OSSL_STORE_INFO_free,
  10. OSSL_STORE_INFO_new_NAME, OSSL_STORE_INFO_set0_NAME_description,
  11. OSSL_STORE_INFO_new_PARAMS, OSSL_STORE_INFO_new_PKEY, OSSL_STORE_INFO_new_CERT,
  12. OSSL_STORE_INFO_new_CRL - Functions to manipulate OSSL_STORE_INFO objects
  13. =head1 SYNOPSIS
  14. #include <openssl/store.h>
  15. typedef struct ossl_store_info_st OSSL_STORE_INFO;
  16. int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *store_info);
  17. const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *store_info);
  18. char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *store_info);
  19. const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO
  20. *store_info);
  21. char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *store_info);
  22. EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *store_info);
  23. EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *store_info);
  24. EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *store_info);
  25. EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *store_info);
  26. X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *store_info);
  27. X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *store_info);
  28. X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *store_info);
  29. X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *store_info);
  30. const char *OSSL_STORE_INFO_type_string(int type);
  31. void OSSL_STORE_INFO_free(OSSL_STORE_INFO *store_info);
  32. OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name);
  33. int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc);
  34. OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(DSA *dsa_params);
  35. OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey);
  36. OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509);
  37. OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl);
  38. =head1 DESCRIPTION
  39. These functions are primarily useful for applications to retrieve
  40. supported objects from B<OSSL_STORE_INFO> objects and for scheme specific
  41. loaders to create B<OSSL_STORE_INFO> holders.
  42. =head2 Types
  43. B<OSSL_STORE_INFO> is an opaque type that's just an intermediary holder for
  44. the objects that have been retrieved by OSSL_STORE_load() and similar functions.
  45. Supported OpenSSL type object can be extracted using one of
  46. STORE_INFO_get0_<TYPE>() where <TYPE> can be NAME, PARAMS, PKEY, CERT, or CRL.
  47. The life time of this extracted object is as long as the life time of
  48. the B<OSSL_STORE_INFO> it was extracted from, so care should be taken not
  49. to free the latter too early.
  50. As an alternative, STORE_INFO_get1_<TYPE>() extracts a duplicate (or the
  51. same object with its reference count increased), which can be used
  52. after the containing B<OSSL_STORE_INFO> has been freed.
  53. The object returned by STORE_INFO_get1_<TYPE>() must be freed separately
  54. by the caller.
  55. See L</SUPPORTED OBJECTS> for more information on the types that are supported.
  56. =head2 Functions
  57. OSSL_STORE_INFO_get_type() takes a B<OSSL_STORE_INFO> and returns the STORE
  58. type number for the object inside.
  59. STORE_INFO_get_type_string() takes a STORE type number and returns a
  60. short string describing it.
  61. OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(),
  62. OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PKEY(),
  63. OSSL_STORE_INFO_get0_CERT() and OSSL_STORE_INFO_get0_CRL() all take a
  64. B<OSSL_STORE_INFO> and return the held object of the appropriate OpenSSL
  65. type provided that's what's held.
  66. OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(),
  67. OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PKEY(),
  68. OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all take a
  69. B<OSSL_STORE_INFO> and return a duplicate of the held object of the
  70. appropriate OpenSSL type provided that's what's held.
  71. OSSL_STORE_INFO_free() frees a B<OSSL_STORE_INFO> and its contained type.
  72. OSSL_STORE_INFO_new_NAME() , OSSL_STORE_INFO_new_PARAMS(),
  73. OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and
  74. OSSL_STORE_INFO_new_CRL() create a B<OSSL_STORE_INFO>
  75. object to hold the given input object.
  76. On success the input object is consumed.
  77. Additionally, for B<OSSL_STORE_INFO_NAME>` objects,
  78. OSSL_STORE_INFO_set0_NAME_description() can be used to add an extra
  79. description.
  80. This description is meant to be human readable and should be used for
  81. information printout.
  82. =head1 SUPPORTED OBJECTS
  83. Currently supported object types are:
  84. =over 4
  85. =item OSSL_STORE_INFO_NAME
  86. A name is exactly that, a name.
  87. It's like a name in a directory, but formatted as a complete URI.
  88. For example, the path in URI C<file:/foo/bar/> could include a file
  89. named C<cookie.pem>, and in that case, the returned B<OSSL_STORE_INFO_NAME>
  90. object would have the URI C<file:/foo/bar/cookie.pem>, which can be
  91. used by the application to get the objects in that file.
  92. This can be applied to all schemes that can somehow support a listing
  93. of object URIs.
  94. For C<file:> URIs that are used without the explicit scheme, the
  95. returned name will be the path of each object, so if C</foo/bar> was
  96. given and that path has the file C<cookie.pem>, the name
  97. C</foo/bar/cookie.pem> will be returned.
  98. The returned URI is considered canonical and must be unique and permanent
  99. for the storage where the object (or collection of objects) resides.
  100. Each loader is responsible for ensuring that it only returns canonical
  101. URIs.
  102. However, it's possible that certain schemes allow an object (or collection
  103. thereof) to be reached with alternative URIs; just because one URI is
  104. canonical doesn't mean that other variants can't be used.
  105. At the discretion of the loader that was used to get these names, an
  106. extra description may be attached as well.
  107. =item OSSL_STORE_INFO_PARAMS
  108. Key parameters.
  109. =item OSSL_STORE_INFO_PKEY
  110. A private/public key of some sort.
  111. =item OSSL_STORE_INFO_CERT
  112. An X.509 certificate.
  113. =item OSSL_STORE_INFO_CRL
  114. A X.509 certificate revocation list.
  115. =back
  116. =head1 RETURN VALUES
  117. OSSL_STORE_INFO_get_type() returns the STORE type number of the given
  118. B<OSSL_STORE_INFO>.
  119. There is no error value.
  120. OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(),
  121. OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PKEY(),
  122. OSSL_STORE_INFO_get0_CERT() and OSSL_STORE_INFO_get0_CRL() all return
  123. a pointer to the OpenSSL object on success, NULL otherwise.
  124. OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(),
  125. OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PKEY(),
  126. OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all return
  127. a pointer to a duplicate of the OpenSSL object on success, NULL otherwise.
  128. OSSL_STORE_INFO_type_string() returns a string on success, or B<NULL> on
  129. failure.
  130. OSSL_STORE_INFO_new_NAME(), OSSL_STORE_INFO_new_PARAMS(),
  131. OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and
  132. OSSL_STORE_INFO_new_CRL() return a B<OSSL_STORE_INFO>
  133. pointer on success, or B<NULL> on failure.
  134. OSSL_STORE_INFO_set0_NAME_description() returns 1 on success, or 0 on
  135. failure.
  136. =head1 SEE ALSO
  137. L<ossl_store(7)>, L<OSSL_STORE_open(3)>, L<OSSL_STORE_register_loader(3)>
  138. =head1 HISTORY
  139. The OSSL_STORE API was added in OpenSSL 1.1.1.
  140. =head1 COPYRIGHT
  141. Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
  142. Licensed under the Apache License 2.0 (the "License"). You may not use
  143. this file except in compliance with the License. You can obtain a copy
  144. in the file LICENSE in the source distribution or at
  145. L<https://www.openssl.org/source/license.html>.
  146. =cut