EVP_KEYMGMT.pod 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. =pod
  2. =head1 NAME
  3. EVP_KEYMGMT,
  4. EVP_KEYMGMT_fetch,
  5. EVP_KEYMGMT_up_ref,
  6. EVP_KEYMGMT_free,
  7. EVP_KEYMGMT_provider,
  8. EVP_KEYMGMT_is_a,
  9. EVP_KEYMGMT_number,
  10. EVP_KEYMGMT_get0_first_name,
  11. EVP_KEYMGMT_do_all_provided,
  12. EVP_KEYMGMT_names_do_all,
  13. EVP_KEYMGMT_gettable_params,
  14. EVP_KEYMGMT_settable_params,
  15. EVP_KEYMGMT_gen_settable_params
  16. - EVP key management routines
  17. =head1 SYNOPSIS
  18. #include <openssl/evp.h>
  19. typedef struct evp_keymgmt_st EVP_KEYMGMT;
  20. EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
  21. const char *properties);
  22. int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);
  23. void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);
  24. const OSSL_PROVIDER *EVP_KEYMGMT_provider(const EVP_KEYMGMT *keymgmt);
  25. int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);
  26. int EVP_KEYMGMT_number(const EVP_KEYMGMT *keymgmt);
  27. const char *EVP_KEYMGMT_get0_first_name(const EVP_KEYMGMT *keymgmt);
  28. void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,
  29. void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
  30. void *arg);
  31. void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
  32. void (*fn)(const char *name, void *data),
  33. void *data);
  34. const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);
  35. const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);
  36. const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);
  37. =head1 DESCRIPTION
  38. B<EVP_KEYMGMT> is a method object that represents key management
  39. implementations for different cryptographic algorithms.
  40. This method object provides functionality to have providers import key
  41. material from the outside, as well as export key material to the
  42. outside.
  43. Most of the functionality can only be used internally and has no
  44. public interface, this object is simply passed into other functions
  45. when needed.
  46. EVP_KEYMGMT_fetch() looks for an algorithm within the provider that
  47. has been loaded into the B<OSSL_LIB_CTX> given by I<ctx>, having the
  48. name given by I<algorithm> and the properties given by I<properties>.
  49. EVP_KEYMGMT_up_ref() increments the reference count for the given
  50. B<EVP_KEYMGMT> I<keymgmt>.
  51. EVP_KEYMGMT_free() decrements the reference count for the given
  52. B<EVP_KEYMGMT> I<keymgmt>, and when the count reaches zero, frees it.
  53. EVP_KEYMGMT_provider() returns the provider that has this particular
  54. implementation.
  55. EVP_KEYMGMT_is_a() checks if I<keymgmt> is an implementation of an
  56. algorithm that's identifiable with I<name>.
  57. EVP_KEYMGMT_number() returns the internal dynamic number assigned to
  58. the I<keymgmt>.
  59. EVP_KEYMGMT_get0_first_name() returns the first algorithm name that is found for
  60. the given I<keymgmt>. Note that the I<keymgmt> may have multiple synonyms
  61. associated with it. In this case it is undefined which one will be returned.
  62. Ownership of the returned string is retained by the I<keymgmt> object and should
  63. not be freed by the caller.
  64. EVP_KEYMGMT_names_do_all() traverses all names for the I<keymgmt>, and
  65. calls I<fn> with each name and I<data>.
  66. EVP_KEYMGMT_do_all_provided() traverses all key keymgmt implementations by
  67. all activated providers in the library context I<libctx>, and for each
  68. of the implementations, calls I<fn> with the implementation method and
  69. I<data> as arguments.
  70. EVP_KEYMGMT_gettable_params() and EVP_KEYMGMT_settable_params() return a
  71. constant B<OSSL_PARAM> array that describes the names and types of key
  72. parameters that can be retrieved or set.
  73. EVP_KEYMGMT_gettable_params() is used by L<EVP_PKEY_gettable_params(3)>.
  74. See L<OSSL_PARAM(3)> for the use of B<OSSL_PARAM> as a parameter descriptor.
  75. EVP_KEYMGMT_gen_settable_params() returns a constant B<OSSL_PARAM> array that
  76. describes the names and types of key generation parameters that can be set via
  77. L<EVP_PKEY_CTX_set_params(3)>.
  78. =head1 NOTES
  79. EVP_KEYMGMT_fetch() may be called implicitly by other fetching
  80. functions, using the same library context and properties.
  81. Any other API that uses keys will typically do this.
  82. =head1 RETURN VALUES
  83. EVP_KEYMGMT_fetch() returns a pointer to the key management
  84. implementation represented by an EVP_KEYMGMT object, or NULL on
  85. error.
  86. EVP_KEYMGMT_up_ref() returns 1 on success, or 0 on error.
  87. EVP_KEYMGMT_free() doesn't return any value.
  88. EVP_KEYMGMT_provider() returns a pointer to a provider object, or NULL
  89. on error.
  90. EVP_KEYMGMT_is_a() returns 1 of I<keymgmt> was identifiable,
  91. otherwise 0.
  92. EVP_KEYMGMT_number() returns an integer.
  93. EVP_KEYMGMT_get0_first_name() returns the name that is found or NULL on error.
  94. EVP_KEYMGMT_gettable_params(), EVP_KEYMGMT_settable_params() and
  95. EVP_KEYMGMT_gen_settable_params() return a constant B<OSSL_PARAM> array or
  96. NULL on error.
  97. =head1 SEE ALSO
  98. L<EVP_MD_fetch(3)>, L<OSSL_LIB_CTX(3)>
  99. =head1 HISTORY
  100. The functions described here were added in OpenSSL 3.0.
  101. =head1 COPYRIGHT
  102. Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  103. Licensed under the Apache License 2.0 (the "License"). You may not use
  104. this file except in compliance with the License. You can obtain a copy
  105. in the file LICENSE in the source distribution or at
  106. L<https://www.openssl.org/source/license.html>.
  107. =cut