EVP_KEYMGMT.3ossl 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "EVP_KEYMGMT 3ossl"
  58. .TH EVP_KEYMGMT 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. EVP_KEYMGMT,
  65. EVP_KEYMGMT_fetch,
  66. EVP_KEYMGMT_up_ref,
  67. EVP_KEYMGMT_free,
  68. EVP_KEYMGMT_get0_provider,
  69. EVP_KEYMGMT_is_a,
  70. EVP_KEYMGMT_get0_description,
  71. EVP_KEYMGMT_get0_name,
  72. EVP_KEYMGMT_do_all_provided,
  73. EVP_KEYMGMT_names_do_all,
  74. EVP_KEYMGMT_gettable_params,
  75. EVP_KEYMGMT_settable_params,
  76. EVP_KEYMGMT_gen_gettable_params,
  77. EVP_KEYMGMT_gen_settable_params
  78. \&\- EVP key management routines
  79. .SH SYNOPSIS
  80. .IX Header "SYNOPSIS"
  81. .Vb 1
  82. \& #include <openssl/evp.h>
  83. \&
  84. \& typedef struct evp_keymgmt_st EVP_KEYMGMT;
  85. \&
  86. \& EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
  87. \& const char *properties);
  88. \& int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);
  89. \& void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);
  90. \& const OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt);
  91. \& int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);
  92. \& const char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt);
  93. \& const char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt);
  94. \&
  95. \& void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,
  96. \& void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
  97. \& void *arg);
  98. \& int EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
  99. \& void (*fn)(const char *name, void *data),
  100. \& void *data);
  101. \& const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);
  102. \& const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);
  103. \& const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);
  104. \& const OSSL_PARAM *EVP_KEYMGMT_gen_gettable_params(const EVP_KEYMGMT *keymgmt);
  105. .Ve
  106. .SH DESCRIPTION
  107. .IX Header "DESCRIPTION"
  108. \&\fBEVP_KEYMGMT\fR is a method object that represents key management
  109. implementations for different cryptographic algorithms.
  110. This method object provides functionality to have providers import key
  111. material from the outside, as well as export key material to the
  112. outside.
  113. Most of the functionality can only be used internally and has no
  114. public interface, this object is simply passed into other functions
  115. when needed.
  116. .PP
  117. \&\fBEVP_KEYMGMT_fetch()\fR looks for an algorithm within the provider that
  118. has been loaded into the \fBOSSL_LIB_CTX\fR given by \fIctx\fR, having the
  119. name given by \fIalgorithm\fR and the properties given by \fIproperties\fR.
  120. .PP
  121. \&\fBEVP_KEYMGMT_up_ref()\fR increments the reference count for the given
  122. \&\fBEVP_KEYMGMT\fR \fIkeymgmt\fR.
  123. .PP
  124. \&\fBEVP_KEYMGMT_free()\fR decrements the reference count for the given
  125. \&\fBEVP_KEYMGMT\fR \fIkeymgmt\fR, and when the count reaches zero, frees it.
  126. If the argument is NULL, nothing is done.
  127. .PP
  128. \&\fBEVP_KEYMGMT_get0_provider()\fR returns the provider that has this particular
  129. implementation.
  130. .PP
  131. \&\fBEVP_KEYMGMT_is_a()\fR checks if \fIkeymgmt\fR is an implementation of an
  132. algorithm that's identifiable with \fIname\fR.
  133. .PP
  134. \&\fBEVP_KEYMGMT_get0_name()\fR returns the algorithm name from the provided
  135. implementation for the given \fIkeymgmt\fR. Note that the \fIkeymgmt\fR may have
  136. multiple synonyms associated with it. In this case the first name from the
  137. algorithm definition is returned. Ownership of the returned string is
  138. retained by the \fIkeymgmt\fR object and should not be freed by the caller.
  139. .PP
  140. \&\fBEVP_KEYMGMT_names_do_all()\fR traverses all names for the \fIkeymgmt\fR, and
  141. calls \fIfn\fR with each name and \fIdata\fR.
  142. .PP
  143. \&\fBEVP_KEYMGMT_get0_description()\fR returns a description of the \fIkeymgmt\fR, meant
  144. for display and human consumption. The description is at the discretion
  145. of the \fIkeymgmt\fR implementation.
  146. .PP
  147. \&\fBEVP_KEYMGMT_do_all_provided()\fR traverses all key keymgmt implementations by
  148. all activated providers in the library context \fIlibctx\fR, and for each
  149. of the implementations, calls \fIfn\fR with the implementation method and
  150. \&\fIdata\fR as arguments.
  151. .PP
  152. \&\fBEVP_KEYMGMT_gettable_params()\fR and \fBEVP_KEYMGMT_settable_params()\fR return a
  153. constant \fBOSSL_PARAM\fR\|(3) array that describes the names and types of key
  154. parameters that can be retrieved or set.
  155. \&\fBEVP_KEYMGMT_gettable_params()\fR is used by \fBEVP_PKEY_gettable_params\fR\|(3).
  156. .PP
  157. \&\fBEVP_KEYMGMT_gen_gettable_params()\fR and \fBEVP_KEYMGMT_gen_settable_params()\fR return a
  158. constant \fBOSSL_PARAM\fR\|(3) array that describes the names and types of key
  159. generation parameters that can be retrieved or set via
  160. \&\fBEVP_PKEY_CTX_get_params\fR\|(3) or \fBEVP_PKEY_CTX_set_params\fR\|(3) respectively.
  161. .SH NOTES
  162. .IX Header "NOTES"
  163. \&\fBEVP_KEYMGMT_fetch()\fR may be called implicitly by other fetching
  164. functions, using the same library context and properties.
  165. Any other API that uses keys will typically do this.
  166. .SH "RETURN VALUES"
  167. .IX Header "RETURN VALUES"
  168. \&\fBEVP_KEYMGMT_fetch()\fR returns a pointer to the key management
  169. implementation represented by an EVP_KEYMGMT object, or NULL on
  170. error.
  171. .PP
  172. \&\fBEVP_KEYMGMT_up_ref()\fR returns 1 on success, or 0 on error.
  173. .PP
  174. \&\fBEVP_KEYMGMT_names_do_all()\fR returns 1 if the callback was called for all
  175. names. A return value of 0 means that the callback was not called for any names.
  176. .PP
  177. \&\fBEVP_KEYMGMT_free()\fR doesn't return any value.
  178. .PP
  179. \&\fBEVP_KEYMGMT_get0_provider()\fR returns a pointer to a provider object, or NULL
  180. on error.
  181. .PP
  182. \&\fBEVP_KEYMGMT_is_a()\fR returns 1 of \fIkeymgmt\fR was identifiable,
  183. otherwise 0.
  184. .PP
  185. \&\fBEVP_KEYMGMT_get0_name()\fR returns the algorithm name, or NULL on error.
  186. .PP
  187. \&\fBEVP_KEYMGMT_get0_description()\fR returns a pointer to a description, or NULL if
  188. there isn't one.
  189. .PP
  190. \&\fBEVP_KEYMGMT_gettable_params()\fR, \fBEVP_KEYMGMT_settable_params()\fR,
  191. \&\fBEVP_KEYMGMT_gen_gettable_params()\fR and \fBEVP_KEYMGMT_gen_settable_params()\fR
  192. return a constant \fBOSSL_PARAM\fR\|(3) array or NULL on error.
  193. .SH "SEE ALSO"
  194. .IX Header "SEE ALSO"
  195. \&\fBEVP_MD_fetch\fR\|(3), \fBOSSL_LIB_CTX\fR\|(3)
  196. .SH HISTORY
  197. .IX Header "HISTORY"
  198. The function \fBEVP_KEYMGMT_gen_gettable_params()\fR was added in OpenSSL 3.4.0
  199. All other functions described here were added in OpenSSL 3.0.
  200. .SH COPYRIGHT
  201. .IX Header "COPYRIGHT"
  202. Copyright 2019\-2024 The OpenSSL Project Authors. All Rights Reserved.
  203. .PP
  204. Licensed under the Apache License 2.0 (the "License"). You may not use
  205. this file except in compliance with the License. You can obtain a copy
  206. in the file LICENSE in the source distribution or at
  207. <https://www.openssl.org/source/license.html>.