OSSL_ENCODER.3ossl 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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 "OSSL_ENCODER 3ossl"
  58. .TH OSSL_ENCODER 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. OSSL_ENCODER,
  65. OSSL_ENCODER_fetch,
  66. OSSL_ENCODER_up_ref,
  67. OSSL_ENCODER_free,
  68. OSSL_ENCODER_get0_provider,
  69. OSSL_ENCODER_get0_properties,
  70. OSSL_ENCODER_is_a,
  71. OSSL_ENCODER_get0_name,
  72. OSSL_ENCODER_get0_description,
  73. OSSL_ENCODER_do_all_provided,
  74. OSSL_ENCODER_names_do_all,
  75. OSSL_ENCODER_gettable_params,
  76. OSSL_ENCODER_get_params
  77. \&\- Encoder method routines
  78. .SH SYNOPSIS
  79. .IX Header "SYNOPSIS"
  80. .Vb 1
  81. \& #include <openssl/encoder.h>
  82. \&
  83. \& typedef struct ossl_encoder_st OSSL_ENCODER;
  84. \&
  85. \& OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
  86. \& const char *properties);
  87. \& int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);
  88. \& void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
  89. \& const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder);
  90. \& const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder);
  91. \& int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
  92. \& const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *encoder);
  93. \& const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *encoder);
  94. \& void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
  95. \& void (*fn)(OSSL_ENCODER *encoder, void *arg),
  96. \& void *arg);
  97. \& int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
  98. \& void (*fn)(const char *name, void *data),
  99. \& void *data);
  100. \& const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);
  101. \& int OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]);
  102. .Ve
  103. .SH DESCRIPTION
  104. .IX Header "DESCRIPTION"
  105. \&\fBOSSL_ENCODER\fR is a method for encoders, which know how to
  106. encode an object of some kind to a encoded form, such as PEM,
  107. DER, or even human readable text.
  108. .PP
  109. \&\fBOSSL_ENCODER_fetch()\fR looks for an algorithm within the provider that
  110. has been loaded into the \fBOSSL_LIB_CTX\fR given by \fIctx\fR, having the
  111. name given by \fIname\fR and the properties given by \fIproperties\fR.
  112. The \fIname\fR determines what type of object the fetched encoder
  113. method is expected to be able to encode, and the properties are
  114. used to determine the expected output type.
  115. For known properties and the values they may have, please have a look
  116. in "Names and properties" in \fBprovider\-encoder\fR\|(7).
  117. .PP
  118. \&\fBOSSL_ENCODER_up_ref()\fR increments the reference count for the given
  119. \&\fIencoder\fR.
  120. .PP
  121. \&\fBOSSL_ENCODER_free()\fR decrements the reference count for the given
  122. \&\fIencoder\fR, and when the count reaches zero, frees it.
  123. If the argument is NULL, nothing is done.
  124. .PP
  125. \&\fBOSSL_ENCODER_get0_provider()\fR returns the provider of the given
  126. \&\fIencoder\fR.
  127. .PP
  128. \&\fBOSSL_ENCODER_get0_properties()\fR returns the property definition associated
  129. with the given \fIencoder\fR.
  130. .PP
  131. \&\fBOSSL_ENCODER_is_a()\fR checks if \fIencoder\fR is an implementation of an
  132. algorithm that's identifiable with \fIname\fR.
  133. .PP
  134. \&\fBOSSL_ENCODER_get0_name()\fR returns the name used to fetch the given \fIencoder\fR.
  135. .PP
  136. \&\fBOSSL_ENCODER_get0_description()\fR returns a description of the \fIloader\fR, meant
  137. for display and human consumption. The description is at the discretion of the
  138. \&\fIloader\fR implementation.
  139. .PP
  140. \&\fBOSSL_ENCODER_names_do_all()\fR traverses all names for the given
  141. \&\fIencoder\fR, and calls \fIfn\fR with each name and \fIdata\fR as arguments.
  142. .PP
  143. \&\fBOSSL_ENCODER_do_all_provided()\fR traverses all encoder
  144. implementations by all activated providers in the library context
  145. \&\fIlibctx\fR, and for each of the implementations, calls \fIfn\fR with the
  146. implementation method and \fIarg\fR as arguments.
  147. .PP
  148. \&\fBOSSL_ENCODER_gettable_params()\fR returns an \fBOSSL_PARAM\fR\|(3)
  149. array of parameter descriptors.
  150. .PP
  151. \&\fBOSSL_ENCODER_get_params()\fR attempts to get parameters specified
  152. with an \fBOSSL_PARAM\fR\|(3) array \fIparams\fR. Parameters that the
  153. implementation doesn't recognise should be ignored.
  154. .SH "RETURN VALUES"
  155. .IX Header "RETURN VALUES"
  156. \&\fBOSSL_ENCODER_fetch()\fR returns a pointer to the key management
  157. implementation represented by an OSSL_ENCODER object, or NULL on
  158. error.
  159. .PP
  160. \&\fBOSSL_ENCODER_up_ref()\fR returns 1 on success, or 0 on error.
  161. .PP
  162. \&\fBOSSL_ENCODER_free()\fR doesn't return any value.
  163. .PP
  164. \&\fBOSSL_ENCODER_get0_provider()\fR returns a pointer to a provider object, or
  165. NULL on error.
  166. .PP
  167. \&\fBOSSL_ENCODER_get0_properties()\fR returns a pointer to a property
  168. definition string, or NULL on error.
  169. .PP
  170. \&\fBOSSL_ENCODER_is_a()\fR returns 1 of \fIencoder\fR was identifiable,
  171. otherwise 0.
  172. .PP
  173. \&\fBOSSL_ENCODER_get0_name()\fR returns the algorithm name from the provided
  174. implementation for the given \fIencoder\fR. Note that the \fIencoder\fR may have
  175. multiple synonyms associated with it. In this case the first name from the
  176. algorithm definition is returned. Ownership of the returned string is retained
  177. by the \fIencoder\fR object and should not be freed by the caller.
  178. .PP
  179. \&\fBOSSL_ENCODER_get0_description()\fR returns a pointer to a description, or NULL if
  180. there isn't one.
  181. .PP
  182. \&\fBOSSL_ENCODER_names_do_all()\fR returns 1 if the callback was called for all
  183. names. A return value of 0 means that the callback was not called for any names.
  184. .SH "SEE ALSO"
  185. .IX Header "SEE ALSO"
  186. \&\fBprovider\fR\|(7), \fBOSSL_ENCODER_CTX\fR\|(3), \fBOSSL_ENCODER_to_bio\fR\|(3),
  187. \&\fBOSSL_ENCODER_CTX_new_for_pkey\fR\|(3), \fBOSSL_LIB_CTX\fR\|(3)
  188. .SH HISTORY
  189. .IX Header "HISTORY"
  190. The functions described here were added in OpenSSL 3.0.
  191. .SH COPYRIGHT
  192. .IX Header "COPYRIGHT"
  193. Copyright 2019\-2024 The OpenSSL Project Authors. All Rights Reserved.
  194. .PP
  195. Licensed under the Apache License 2.0 (the "License"). You may not use
  196. this file except in compliance with the License. You can obtain a copy
  197. in the file LICENSE in the source distribution or at
  198. <https://www.openssl.org/source/license.html>.