LIBRESSL-EVP_PKEY_GET_DEFAULT_DIGEST_NID(3)
π EVP_PKEY_GET_DEFAULT_DIGEST_NID(3) β get default signature digest π
okay so bestie, this is a LibreSSL libcrypto page from the Library Functions Manual, and it's here to explain how to get the default signature digest for a public key. slay β¨
πΈ NAME πΈ
EVP_PKEY_get_default_digest_nid β get default signature digest
π SYNOPSIS π
here's the synopsis, character-for-character, curly quotes and all π«Ά
library βlibcryptoβ #include <openssl/evp.h>
int
EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
π DESCRIPTION π
The EVP_PKEY_get_default_digest_nid() function sets *pnid to the default message digest NID for the public key signature operations associated with pkey. literally what it says on the tin π
Some signature algorithms, for example EVP_PKEY_ED25519, do not use a digest during signing. In this case, *pnid is set to NID_undef. no digest, no drama π¦
Support for the following public key algorithms is built into the library. The columns are EVP_PKEY_base_id(3), *pnid, and return value β here's the same tea in bullet form:
- For
EVP_PKEY_DSA:*pnidisNID_sha1, and the return value label ismandatory. - For
EVP_PKEY_EC:*pnidisNID_sha1, and the return value label ismandatory. - For
EVP_PKEY_ED25519:*pnidisNID_undef, and the return value label ismandatory. - For
EVP_PKEY_HMAC:*pnidisNID_sha1, and the return value label isadvisory. - For
EVP_PKEY_RSA:*pnidisNID_sha256, and the return value label isadvisory.
π₯ RETURN VALUES π₯
The EVP_PKEY_get_default_digest_nid() function returns 1 if the message digest is advisory (that is, other digests can be used) and 2 if it is mandatory (other digests cannot be used). It returns 0 or a negative value for failure. In particular, a return value of -2 indicates the operation is not supported by the public key algorithm. that -2 is the "algorithm said no β€οΈ" signal π
π SEE ALSO π
EVP_PKEY_CTX_ctrl(3)EVP_PKEY_CTX_new(3)EVP_PKEY_new(3)EVP_PKEY_sign(3)EVP_PKEY_verify(3)EVP_PKEY_verify_recover(3)
π°οΈ HISTORY π°οΈ
EVP_PKEY_get_default_digest_nid() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9. vintage but still iconic π«
footer sign-off: source/version is Debian, date is June 8 (the year in the raw footer is colliding with the page tag, so I am not inventing digits, bestie π), and the page tag is EVP_PKEY_GET_DEFAULT_DIGEST_NID(3). mwah ππ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2006, 2009, 2013, 2018 The OpenSSL Project
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms