EVP_PKEY_set_type.pod 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. =pod
  2. =head1 NAME
  3. EVP_PKEY_set_type, EVP_PKEY_set_type_str, EVP_PKEY_set_type_by_keymgmt
  4. - functions to change the EVP_PKEY type
  5. =head1 SYNOPSIS
  6. #include <openssl/evp.h>
  7. int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
  8. int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
  9. int EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt);
  10. =head1 DESCRIPTION
  11. All the functions described here behave the same in so far that they
  12. clear all the previous key data and methods from I<pkey>, and reset it
  13. to be of the type of key given by the different arguments. If
  14. I<pkey> is NULL, these functions will still return the same return
  15. values as if it wasn't.
  16. EVP_PKEY_set_type() initialises I<pkey> to contain an internal legacy
  17. key. When doing this, it finds a L<EVP_PKEY_ASN1_METHOD(3)>
  18. corresponding to I<type>, and associates I<pkey> with the findings.
  19. It is an error if no L<EVP_PKEY_ASN1_METHOD(3)> could be found for
  20. I<type>.
  21. EVP_PKEY_set_type_str() initialises I<pkey> to contain an internal legacy
  22. key. When doing this, it finds a L<EVP_PKEY_ASN1_METHOD(3)>
  23. corresponding to I<str> that has then length I<len>, and associates
  24. I<pkey> with the findings.
  25. It is an error if no L<EVP_PKEY_ASN1_METHOD(3)> could be found for
  26. I<type>.
  27. For both EVP_PKEY_set_type() and EVP_PKEY_set_type_str(), I<pkey> gets
  28. a numeric type, which can be retrieved with L<EVP_PKEY_id(3)>. This
  29. numeric type is taken from the L<EVP_PKEY_ASN1_METHOD(3)> that was
  30. found, and is equal to or closely related to I<type> in the case of
  31. EVP_PKEY_set_type(), or related to I<str> in the case of
  32. EVP_PKEY_set_type_str().
  33. EVP_PKEY_set_type_by_keymgmt() initialises I<pkey> to contain an
  34. internal provider side key. When doing this, it associates I<pkey>
  35. with I<keymgmt>. For keys initialised like this, the numeric type
  36. retrieved with L<EVP_PKEY_id(3)> will always be B<EVP_PKEY_NONE>.
  37. =head1 RETURN VALUES
  38. All functions described here return 1 if successful, or 0 on error.
  39. =head1 SEE ALSO
  40. L<EVP_PKEY_assign(3)>, L<EVP_PKEY_id(3)>, L<EVP_PKEY_get0_RSA(3)>,
  41. L<EVP_PKEY_copy_parameters(3)>, L<EVP_PKEY_ASN1_METHOD(3)>,
  42. L<EVP_KEYMGMT(3)>
  43. =head1 COPYRIGHT
  44. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  45. Licensed under the Apache License 2.0 (the "License"). You may not use
  46. this file except in compliance with the License. You can obtain a copy
  47. in the file LICENSE in the source distribution or at
  48. L<https://www.openssl.org/source/license.html>.
  49. =cut