LIBRESSL-X509_GET_PUBKEY_PARAMETERS(3)
π NAME π
Okay bestie, meet X509_get_pubkey_parameters β copy public key parameters from a chain. This is the LIBRESSL-X509_GET_PUBKEY_PARAMETERS(3) page from the Library Functions Manual; the source header spells it X509_GET_PUBKEY_PARAMETE(3) (tiny typo, we still love her π). It's a libcrypto situation, and yes, she's serving chain-parameter-copying realness. π«Ά
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/x509.h>
int
X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain);
πΈ DESCRIPTION πΈ
So what does X509_get_pubkey_parameters() do? It copies public key parameters from the first appropriate certificate in the chain. That's the main character move. π
Here's the vibe check on pkey:
- If
pkeyis notNULLand already contains complete public key parameters, or if it uses an algorithm that does not use any parameters, then no action occurs, and the function indicates success. It does this without inspecting the existing parameters, without inspecting thechain, and without comparing any parameters. Literally not even peeking. π
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. Periodt. β¨
π RETURN VALUES π
X509_get_pubkey_parameters() returns 1 for success or 0 for failure. That's it, that's the whole report card. π
π ERRORS π
You can retrieve the following diagnostics 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 thechainfailed 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 thechaincontain complete public key parameters.
π¦ SEE ALSO π¦
Go be nosy, bestie: 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. She's vintage, she's iconic, she's been in the group chat since forever. π
π CAVEATS π
IfX509_get_pubkey_parameters()fails and returns0, a part of the parameters may or may not have been copied before the failure was detected, whereas other parts ofpkeyandchainmay remain unchanged. So in case of failure, the state of the arguments may change and possibly become inconsistent.
So yeah β on failure, the arguments can be left in a messy little state, and possibly inconsistent. Not a clean rollback moment, bestie. π«
This page is from Debian, dated June 8, 2025, and it lives at X509_GET_PUBKEY_PARAMETERS(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) 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms