EVP_PKEY_todata.pod 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. =pod
  2. =head1 NAME
  3. EVP_PKEY_todata, EVP_PKEY_export
  4. - functions to return keys as an array of key parameters
  5. =head1 SYNOPSIS
  6. #include <openssl/evp.h>
  7. int EVP_PKEY_todata(const EVP_PKEY *pkey, int selection, OSSL_PARAM **params);
  8. int EVP_PKEY_export(const EVP_PKEY *pkey, int selection,
  9. OSSL_CALLBACK *export_cb, void *export_cbarg);
  10. =head1 DESCRIPTION
  11. The functions described here are used to extract B<EVP_PKEY> key values as an
  12. array of L<OSSL_PARAM(3)>.
  13. EVP_PKEY_todata() extracts values from a key I<pkey> using the I<selection>.
  14. I<selection> is described in L<EVP_PKEY_fromdata(3)/Selections>.
  15. L<OSSL_PARAM_free(3)> should be used to free the returned parameters in
  16. I<*params>.
  17. EVP_PKEY_export() is similar to EVP_PKEY_todata() but uses a callback
  18. I<export_cb> that gets passed the value of I<export_cbarg>.
  19. See L<openssl-core.h(7)> for more information about the callback. Note that the
  20. L<OSSL_PARAM(3)> array that is passed to the callback is not persistent after the
  21. callback returns. The user must preserve the items of interest, or use
  22. EVP_PKEY_todata() if persistence is required.
  23. =head1 NOTES
  24. These functions only work with key management methods coming from a provider.
  25. This is the mirror function to L<EVP_PKEY_fromdata(3)>.
  26. =head1 RETURN VALUES
  27. EVP_PKEY_todata() and EVP_PKEY_export() return 1 for success and 0 for failure.
  28. =head1 SEE ALSO
  29. L<OSSL_PARAM(3)>, L<openssl-core.h(7)>,
  30. L<EVP_PKEY_fromdata(3)>,
  31. L<EVP_PKEY-RSA(7)>, L<EVP_PKEY-DSA(7)>, L<EVP_PKEY-DH(7)>, L<EVP_PKEY-EC(7)>,
  32. L<EVP_PKEY-ED448(7)>, L<EVP_PKEY-X25519(7)>, L<EVP_PKEY-X448(7)>,
  33. L<EVP_PKEY-ED25519(7)>
  34. =head1 HISTORY
  35. These functions were added in OpenSSL 3.0.
  36. =head1 COPYRIGHT
  37. Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.
  38. Licensed under the Apache License 2.0 (the "License"). You may not use
  39. this file except in compliance with the License. You can obtain a copy
  40. in the file LICENSE in the source distribution or at
  41. L<https://www.openssl.org/source/license.html>.
  42. =cut