EVP_PKEY_PRINT_PRIVATE(3ossl)

πŸ’– EVP_PKEY_PRINT_PRIVATE πŸ’–

okay bestie, welcome to the OpenSSL corner of the manual where we print out keys. yes, actual keys. this is EVP_PKEY_PRINT_PRIVATE(3ossl) and it's giving "i just want to see what's inside my key" energy πŸ¦‹


✨ 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-human-readable-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 tea, bestie. 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 sends the key to the BIO out in human readable form β€” no cap, actually readable. and the indent parameter tells the printout how far it should be indented, so your output can be as aesthetically layered as your playlist πŸŽ€

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. simple as that ✨

and then we have EVP_PKEY_print_public_fp(), EVP_PKEY_print_private_fp() and EVP_PKEY_print_params_fp() β€” these do the exact same thing as the BIO based functions but they use FILE fp instead. same vibe, different destination, iykyk πŸ’œ


🌈 NOTES 🌈

currently no public key algorithms include any options in the pctx parameter. like, zero. none. it's giving empty party 😭 so don't go looking for hidden configs in there.

and if the key does not include all the components indicated by the function, then only those contained in the key will be printed. for example, passing a public key to EVP_PKEY_print_private() will only print the public components. it's not gonna manifest private parts out of nowhere, bestie πŸ™ˆ


⭐ RETURN VALUES ⭐

these functions all return 1 for success and 0 or a negative value for failure. and specifically, a return value of -2 indicates the operation is not supported by the public key algorithm. so if you see that -2, that's the algorithm saying "not me, not today" πŸ’€


πŸ¦‹ SEE ALSO πŸ¦‹


πŸŽ€ HISTORY πŸŽ€

  • the functions EVP_PKEY_print_public(), EVP_PKEY_print_private(), and EVP_PKEY_print_params() were added in OpenSSL 1.0.0. og behavior fr fr.
  • the functions EVP_PKEY_print_public_fp(), EVP_PKEY_print_private_fp(), and EVP_PKEY_print_params_fp() were added in OpenSSL 3.0. the newer era, the fp era ✨

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, you ate it 🫢 this was OpenSSL 3.5.9, dated 2026-09-29, and it lives under the name EVP_PKEY_PRINT_PRIVATE(3ossl). go forth and print those keys, main character πŸ’…πŸŒΈ

πŸ“¦ where this page comes from