EVP_PKEY_PRINT_PRIVATE(3ossl)
π EVP_PKEY_PRINT_PRIVATE β the OpenSSL 3ossl print party
okay bestie so this whole page lives in the OpenSSL 3ossl manual family, and it's literally all about printing out keys in human-readable form. like, making your key components say hi in text. obsessed.
β¨ NAME β¨
EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params, EVP_PKEY_print_public_fp, EVP_PKEY_print_private_fp, EVP_PKEY_print_params_fp β the public key algorithm printing routines, aka the glow-up-your-key-into-text squad π
π¦ SYNOPSIS π¦
#include <openssl/evp.h>
int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx);
int EVP_PKEY_print_public_fp(FILE *fp, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx);
int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx);
int EVP_PKEY_print_private_fp(FILE *fp, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx);
int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx);
int EVP_PKEY_print_params_fp(FILE *fp, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx);
πΈ DESCRIPTION πΈ
So here's the vibe. EVP_PKEY_print_public(), EVP_PKEY_print_private() and EVP_PKEY_print_params() print out the public, private or parameter components of the key pkey, respectively. Each one takes its own lane, no overlap, no drama. π
The key gets sent to the BIO out in human readable form (yes, actual readable text, not just a wall of bytes β slay).
The parameter indent tells it how far the printout should be indented. cute, right? it's giving formatting.
The pctx parameter lets you finely tune the print output by using ASN1 printing options. If pctx is set to NULL then default values will be used β so no stress if you don't have strong feelings about ASN1 options today.
And the _fp girlies: EVP_PKEY_print_public_fp(), EVP_PKEY_print_private_fp() and EVP_PKEY_print_params_fp() do the exact same thing as the BIO-based functions, except they use FILE fp instead. same energy, different stream. π₯
π NOTES π
Not me having to tell you this, but: currently no public key algorithms include any options in the pctx parameter. so like, pctx exists, it's valid, it's just... lowkey not doing anything yet. iykyk.
Also important β if the key doesn't include all the components indicated by the function, then only the components actually contained in the key will be printed. fr fr. so for example, passing a public key to EVP_PKEY_print_private() will only print the public components. no invented private parts, no cap. π
π«Ά RETURN VALUES π«Ά
All of these functions return 1 for success and 0 or a negative value for failure.
And specifically β a return value of -2 means the operation is not supported by the public key algorithm. so if you see -2, that's the algorithm saying "not my thing", it's not you. π
π§ SEE ALSO π§
β HISTORY β
EVP_PKEY_print_public(),EVP_PKEY_print_private(), andEVP_PKEY_print_params()were added in OpenSSL 1.0.0. the OGs. πEVP_PKEY_print_public_fp(),EVP_PKEY_print_private_fp(), andEVP_PKEY_print_params_fp()were added in OpenSSL 3.0. the newer arrivals, and honestly? iconic.
π COPYRIGHT π
Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page bestie, go print some keys πβ¨π
sign-off: this absolute queen of a manpage is from OpenSSL version 3.5.0, dated 2026-09-25 β EVP_PKEY_PRINT_PRIVATE(3ossl), periodt. π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms