---
name: "libressl-X509_get_pubkey_parameters"
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-X509_get_pubkey_parameters"
---

# libressl-X509\_get\_pubkey\_parameters(3)

copy public key parameters from a chain

## NAME

**X509\_get\_pubkey\_parameters** – copy public key parameters from a chain

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/x509.h\>**

*int*\

**X509\_get\_pubkey\_parameters**(*EVP\_PKEY \*pkey*, *STACK\_OF(X509) \*chain*);

## DESCRIPTION

**X509\_get\_pubkey\_parameters**() copies public key parameters from the first appropriate certificate in the *chain*.

If *pkey* is not NULL and already contains complete public key parameters or uses an algorithm that does not use any parameters, no action occurs and the function indicates success without inspecting the existing parameters, without inspecting the *chain*, and without comparing any parameters.

Otherwise, all public key parameters are copied from the first certificate in the *chain* that contains complete public key parameters to each certificate preceding it in the *chain*. Unless *pkey* is a NULL pointer, the same parameters are also copied to *pkey*.

## RETURN VALUES

**X509\_get\_pubkey\_parameters**() returns 1 for success or 0 for failure.

## ERRORS

The following diagnostics can be retrieved with ERR\_get\_error(3), ERR\_GET\_REASON(3), and ERR\_reason\_error\_string(3):

- X509\_R\_UNABLE\_TO\_GET\_CERTS\_PUBLIC\_KEY "unable to get certs public key"

  Retrieving the public key from a certificate in the *chain* failed before a certificate containing complete public key parameters could be found.

-

  X509\_R\_UNABLE\_TO\_FIND\_PARAMETERS\_IN\_CHAIN "unable to find parameters in chain" None of the certificates in the chain contain complete public key parameters.

## SEE ALSO

EVP\_PKEY\_copy\_parameters(3), EVP\_PKEY\_new(3), X509\_get\_pubkey(3), X509\_new(3)

## HISTORY

**X509\_get\_pubkey\_parameters**() first appeared in SSLeay 0.8.0 and has been available since OpenBSD 2.4.

## CAVEATS

If **X509\_get\_pubkey\_parameters**() fails and returns 0, a part of the parameters may or may not have been copied before the failure was detected, whereas other parts of *pkey* and *chain* may remain unchanged. So in case of failure, the state of the arguments may change and possibly become inconsistent.
