OSSL_ENCODER.pod 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. =pod
  2. =head1 NAME
  3. OSSL_ENCODER,
  4. OSSL_ENCODER_fetch,
  5. OSSL_ENCODER_up_ref,
  6. OSSL_ENCODER_free,
  7. OSSL_ENCODER_provider,
  8. OSSL_ENCODER_properties,
  9. OSSL_ENCODER_is_a,
  10. OSSL_ENCODER_number,
  11. OSSL_ENCODER_do_all_provided,
  12. OSSL_ENCODER_names_do_all,
  13. OSSL_ENCODER_gettable_params,
  14. OSSL_ENCODER_get_params
  15. - Encoder method routines
  16. =head1 SYNOPSIS
  17. #include <openssl/encoder.h>
  18. typedef struct ossl_encoder_st OSSL_ENCODER;
  19. OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
  20. const char *properties);
  21. int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);
  22. void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
  23. const OSSL_PROVIDER *OSSL_ENCODER_provider(const OSSL_ENCODER *encoder);
  24. const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder);
  25. int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
  26. int OSSL_ENCODER_number(const OSSL_ENCODER *encoder);
  27. void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
  28. void (*fn)(OSSL_ENCODER *encoder, void *arg),
  29. void *arg);
  30. void OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
  31. void (*fn)(const char *name, void *data),
  32. void *data);
  33. const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);
  34. int OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]);
  35. =head1 DESCRIPTION
  36. B<OSSL_ENCODER> is a method for encoders, which know how to
  37. encode an object of some kind to a encoded form, such as PEM,
  38. DER, or even human readable text.
  39. OSSL_ENCODER_fetch() looks for an algorithm within the provider that
  40. has been loaded into the B<OSSL_LIB_CTX> given by I<ctx>, having the
  41. name given by I<name> and the properties given by I<properties>.
  42. The I<name> determines what type of object the fetched encoder
  43. method is expected to be able to encode, and the properties are
  44. used to determine the expected output type.
  45. For known properties and the values they may have, please have a look
  46. in L<provider-encoder(7)/Names and properties>.
  47. OSSL_ENCODER_up_ref() increments the reference count for the given
  48. I<encoder>.
  49. OSSL_ENCODER_free() decrements the reference count for the given
  50. I<encoder>, and when the count reaches zero, frees it.
  51. OSSL_ENCODER_provider() returns the provider of the given
  52. I<encoder>.
  53. OSSL_ENCODER_provider() returns the property definition associated
  54. with the given I<encoder>.
  55. OSSL_ENCODER_is_a() checks if I<encoder> is an implementation of an
  56. algorithm that's identifiable with I<name>.
  57. OSSL_ENCODER_number() returns the internal dynamic number assigned to
  58. the given I<encoder>.
  59. OSSL_ENCODER_names_do_all() traverses all names for the given
  60. I<encoder>, and calls I<fn> with each name and I<data>.
  61. OSSL_ENCODER_do_all_provided() traverses all encoder
  62. implementations by all activated providers in the library context
  63. I<libctx>, and for each of the implementations, calls I<fn> with the
  64. implementation method and I<data> as arguments.
  65. OSSL_ENCODER_gettable_params() returns an L<OSSL_PARAM(3)>
  66. array of parameter descriptors.
  67. OSSL_ENCODER_get_params() attempts to get parameters specified
  68. with an L<OSSL_PARAM(3)> array I<params>. Parameters that the
  69. implementation doesn't recognise should be ignored.
  70. =head1 NOTES
  71. OSSL_ENCODER_fetch() may be called implicitly by other fetching
  72. functions, using the same library context and properties.
  73. Any other API that uses keys will typically do this.
  74. =head1 RETURN VALUES
  75. OSSL_ENCODER_fetch() returns a pointer to the key management
  76. implementation represented by an OSSL_ENCODER object, or NULL on
  77. error.
  78. OSSL_ENCODER_up_ref() returns 1 on success, or 0 on error.
  79. OSSL_ENCODER_free() doesn't return any value.
  80. OSSL_ENCODER_provider() returns a pointer to a provider object, or
  81. NULL on error.
  82. OSSL_ENCODER_properties() returns a pointer to a property
  83. definition string, or NULL on error.
  84. OSSL_ENCODER_is_a() returns 1 of I<encoder> was identifiable,
  85. otherwise 0.
  86. OSSL_ENCODER_number() returns an integer.
  87. =head1 SEE ALSO
  88. L<provider(7)>, L<OSSL_ENCODER_CTX(3)>, L<OSSL_ENCODER_to_bio(3)>,
  89. L<OSSL_ENCODER_CTX_new_by_EVP_PKEY(3)>, L<OSSL_LIB_CTX(3)>
  90. =head1 HISTORY
  91. The functions described here were added in OpenSSL 3.0.
  92. =head1 COPYRIGHT
  93. Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  94. Licensed under the Apache License 2.0 (the "License"). You may not use
  95. this file except in compliance with the License. You can obtain a copy
  96. in the file LICENSE in the source distribution or at
  97. L<https://www.openssl.org/source/license.html>.
  98. =cut