EVP_KEYMGMT.pod 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_do_all_provided,
  11. EVP_KEYMGMT_names_do_all
  12. - EVP key management routines
  13. =head1 SYNOPSIS
  14. #include <openssl/evp.h>
  15. typedef struct evp_keymgmt_st EVP_KEYMGMT;
  16. EVP_KEYMGMT *EVP_KEYMGMT_fetch(OPENSSL_CTX *ctx, const char *algorithm,
  17. const char *properties);
  18. int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);
  19. void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);
  20. const OSSL_PROVIDER *EVP_KEYMGMT_provider(const EVP_KEYMGMT *keymgmt);
  21. int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);
  22. int EVP_KEYMGMT_number(const EVP_KEYMGMT *keymgmt);
  23. void EVP_KEYMGMT_do_all_provided(OPENSSL_CTX *libctx,
  24. void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
  25. void *arg);
  26. void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
  27. void (*fn)(const char *name, void *data),
  28. void *data);
  29. =head1 DESCRIPTION
  30. B<EVP_KEYMGMT> is a method object that represents key management
  31. implementations for different cryptographic algorithms.
  32. This method object provides functionality to have providers import key
  33. material from the outside, as well as export key material to the
  34. outside.
  35. Most of the functionality can only be used internally and has no
  36. public interface, this object is simply passed into other functions
  37. when needed.
  38. EVP_KEYMGMT_fetch() looks for an algorithm within the provider that
  39. has been loaded into the B<OPENSSL_CTX> given by I<ctx>, having the
  40. name given by I<algorithm> and the properties given by I<properties>.
  41. EVP_KEYMGMT_up_ref() increments the reference count for the given
  42. B<EVP_KEYMGMT> I<keymgmt>.
  43. EVP_KEYMGMT_free() decrements the reference count for the given
  44. B<EVP_KEYMGMT> I<keymgmt>, and when the count reaches zero, frees it.
  45. EVP_KEYMGMT_provider() returns the provider that has this particular
  46. implementation.
  47. EVP_KEYMGMT_is_a() checks if I<keymgmt> is an implementation of an
  48. algorithm that's identifiable with I<name>.
  49. EVP_KEYMGMT_number() returns the internal dynamic number assigned to
  50. the I<keymgmt>.
  51. EVP_KEYMGMT_names_do_all() traverses all names for the I<keymgmt>, and
  52. calls I<fn> with each name and I<data>.
  53. EVP_KEYMGMT_do_all_provided() traverses all key keymgmt implementations by
  54. all activated providers in the library context I<libctx>, and for each
  55. of the implementations, calls I<fn> with the implementation method and
  56. I<data> as arguments.
  57. =head1 NOTES
  58. EVP_KEYMGMT_fetch() may be called implicitly by other fetching
  59. functions, using the same library context and properties.
  60. Any other API that uses keys will typically do this.
  61. =head1 RETURN VALUES
  62. EVP_KEYMGMT_fetch() returns a pointer to the key management
  63. implementation represented by an EVP_KEYMGMT object, or NULL on
  64. error.
  65. EVP_KEYMGMT_up_ref() returns 1 on success, or 0 on error.
  66. EVP_KEYMGMT_free() doesn't return any value.
  67. EVP_KEYMGMT_provider() returns a pointer to a provider object, or NULL
  68. on error.
  69. EVP_KEYMGMT_is_a() returns 1 of I<keymgmt> was identifiable,
  70. otherwise 0.
  71. EVP_KEYMGMT_number() returns an integer.
  72. =head1 SEE ALSO
  73. L<EVP_MD_fetch(3)>, L<OPENSSL_CTX(3)>
  74. =head1 HISTORY
  75. The functions described here were added in OpenSSL 3.0.
  76. =head1 COPYRIGHT
  77. Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
  78. Licensed under the Apache License 2.0 (the "License"). You may not use
  79. this file except in compliance with the License. You can obtain a copy
  80. in the file LICENSE in the source distribution or at
  81. L<https://www.openssl.org/source/license.html>.
  82. =cut