EVP_PKEY_get_default_digest_nid.pod 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. =pod
  2. =head1 NAME
  3. EVP_PKEY_get_default_digest_nid, EVP_PKEY_get_default_digest_name
  4. - get default signature digest
  5. =head1 SYNOPSIS
  6. #include <openssl/evp.h>
  7. int EVP_PKEY_get_default_digest_name(EVP_PKEY *pkey,
  8. char *mdname, size_t mdname_sz);
  9. int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
  10. =head1 DESCRIPTION
  11. EVP_PKEY_get_default_digest_name() fills in the default message digest
  12. name for the public key signature operations associated with key
  13. I<pkey> into I<mdname>, up to at most I<mdname_sz> bytes including the
  14. ending NUL byte. The name could be C<"UNDEF">, signifying that no digest
  15. should be used.
  16. EVP_PKEY_get_default_digest_nid() sets I<pnid> to the default message
  17. digest NID for the public key signature operations associated with key
  18. I<pkey>. Note that some signature algorithms (i.e. Ed25519 and Ed448)
  19. do not use a digest during signing. In this case I<pnid> will be set
  20. to NID_undef. This function is only reliable for legacy keys, which
  21. are keys with a B<EVP_PKEY_ASN1_METHOD>; these keys have typically
  22. been loaded from engines, or created with L<EVP_PKEY_assign_RSA(3)> or
  23. similar.
  24. =head1 NOTES
  25. For all current standard OpenSSL public key algorithms SHA256 is returned.
  26. =head1 RETURN VALUES
  27. EVP_PKEY_get_default_digest_name() and EVP_PKEY_get_default_digest_nid()
  28. both return 1 if the message digest is advisory (that is other digests
  29. can be used) and 2 if it is mandatory (other digests can not be used).
  30. They return 0 or a negative value for failure. In particular a return
  31. value of -2 indicates the operation is not supported by the public key
  32. algorithm.
  33. =head1 SEE ALSO
  34. L<EVP_PKEY_CTX_new(3)>,
  35. L<EVP_PKEY_sign(3)>,
  36. L<EVP_PKEY_digestsign_supports_digest(3)>,
  37. L<EVP_PKEY_verify(3)>,
  38. L<EVP_PKEY_verify_recover(3)>,
  39. =head1 HISTORY
  40. This function was added in OpenSSL 1.0.0.
  41. =head1 COPYRIGHT
  42. Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
  43. Licensed under the Apache License 2.0 (the "License"). You may not use
  44. this file except in compliance with the License. You can obtain a copy
  45. in the file LICENSE in the source distribution or at
  46. L<https://www.openssl.org/source/license.html>.
  47. =cut