PUBLICKEY(3)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… PUBLICKEY(3) πŸ’…

okay so bestie, this is the PUBLICKEY(3) manual page from the Library Functions Manual β€” and it's literally all about getting keys, like, the keys. buckle up πŸŽ€


✨ NAME ✨

publickey, getpublickey, getsecretkey β€” get public or secret key πŸ—οΈβœ¨

πŸ“š LIBRARY πŸ“š

RPC Service Library β€” that's librpcsvc, and you link it with -lrpcsvc. no cap. 🫢

🩷 SYNOPSIS 🩷

okay so first you gotta bring in the headers, like:

#include <rpc/rpc.h>
#include <rpc/key_prot.h>

then the functions themselves, in all their iconic glory:

int
getpublickey(const char netname[MAXNETNAMELEN+1],
    char publickey[HEXKEYBYTES+1]);

int
getsecretkey(char netname[MAXNETNAMELEN+1],
    char secretkey[HEXKEYBYTES+1], char *passwd);

note the sizes bestie β€” MAXNETNAMELEN+1 for the netname, HEXKEYBYTES+1 for the key. they're literally right there in the brackets, do not come for me πŸ”₯

🌸 DESCRIPTION 🌸

okay so these routines are the ones you call to get public and secret keys out of the YP database. that's the whole vibe. πŸ’«

getsecretkey() is the one with the extra little bonus argument β€” passwd β€” and it's there for a reason: it's what decrypts the encrypted secret key that's stored in the database. so like, the secret key is sitting in there all locked up, and passwd is the key to the key πŸ”βœ¨ it's giving layers.

both routines return 1 if they were successful in finding the key, and 0 otherwise. simple as that, no cap. πŸ‘‘

and the keys themselves come back as NUL-terminated, hexadecimal strings β€” so like, hex text, with a NUL at the end. iconic formatting tbh. πŸŽ€

⚠️ okay this part is important bestie, pay attention: if the password you supplied to getsecretkey() fails to decrypt the secret key, the routine will still return 1 β€” but the secretkey argument will be a NUL string (""). so it looks like a success but you got literally nothing back 😭 fr fr, vibe check your password before you trust that return value πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

  • publickey(5)
  • RPC Programmer's Manual in /usr/share/doc/psd/23.rpc

and that's the whole page, bestie β€” mwah πŸ’‹

this lil slice of Debian history is dated October 6, 1987 and comes to you from the Debian crew. old but still slaying πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from