EVP_PKEY_PRINT_PRIVATE(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… EVP_PKEY_PRINT_PRIVATE(3) β€” like, the crypto printing girlies

okay so bestie, this is a page from the Library Functions Manual, and it's about the public key algorithm printing routines. yes, that's a whole thing, and yes, we're gonna get into it πŸŽ€


✨ NAME ✨

EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params β€” the public key algorithm printing routines. it's giving "make my key readable," fr fr 🫢


🌸 SYNOPSIS 🌸

first things first, you gotta pull in the library: libcrypto

#include <openssl/evp.h>

then, the three icons themselves:

int
EVP_PKEY_print_public(BIO *out, 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_params(BIO *out, const EVP_PKEY *pkey, int indent,
    ASN1_PCTX *pctx);

like, same shape, three different jobs. main character energy for each πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” 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 handles its own little slice, and they're all obsessed with their specific job.

the key gets sent to the BIO out in human readable form β€” like, actual words and numbers your eyeballs can parse, not a wall of hex. iconic ✨

the parameter indent tells it how far the printout should be indented. yes, it's just spacing. yes, it matters. aesthetics are content πŸ’–

the pctx parameter lets you finely tune the print output by using ASN.1 printing options. if pctx is set to NULL, then default values will be used. and ngl, currently, no public key algorithms include any options in the pctx parameter β€” so it's kind of just sitting there looking pretty rn πŸ™ˆ

and here's the part where it gets smart: if the key does not include all the components indicated by the function, then only those contained in the key will be printed. like, for example, passing a public key to EVP_PKEY_print_private() will only print the public components. it prints what it has, no invented lore, no cap 🧚


⭐ RETURN VALUES ⭐

okay so the vibe check on returns:

  • 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 -2, that's your sign, it's not a you problem, the algorithm just doesn't do that πŸ’€


🌈 SEE ALSO 🌈

go read these next, iykyk:


πŸ‘‘ HISTORY πŸ‘‘

these functions first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9. so they've been around. veteran icons only πŸ”₯


and that's the whole page, bestie πŸ“ β€” written by the Debian girlies, dated June 8, 2025, and filed under EVP_PKEY_PRINT_PRIVATE(3). slay, go print some keys πŸ’œ

πŸ“¦ where this page comes from