---
name: "libressl-EVP_PKEY_get_default_digest_nid"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-EVP_PKEY_get_default_digest_nid"
---

# libressl-EVP\_PKEY\_get\_default\_digest\_nid(3)

get default signature digest

## NAME

**EVP\_PKEY\_get\_default\_digest\_nid** – get default signature digest

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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*.

Some signature algorithms, for example EVP\_PKEY\_ED25519, do not use a digest during signing. In this case, \**pnid* is set to NID\_undef.

Support for the following public key algorithms is built into the library:

| | | |
| --- | --- | --- |
| EVP\_PKEY\_base\_id(3) | \**pnid* | return value |
| EVP\_PKEY\_DSA | NID\_sha1 | mandatory |
| EVP\_PKEY\_EC | NID\_sha1 | mandatory |
| EVP\_PKEY\_ED25519 | NID\_undef | mandatory |
| EVP\_PKEY\_HMAC | NID\_sha1 | advisory |
| EVP\_PKEY\_RSA | NID\_sha256 | advisory |

## 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.

## 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.
