X509_GET_SUBJECT_NAME(3)
π NAME π
X509_get_subject_name, X509_set_subject_name, X509_get_issuer_name, X509_set_issuer_name, X509_REQ_get_subject_name, X509_REQ_set_subject_name, X509_CRL_get_issuer, X509_CRL_set_issuer_name β get and set issuer or subject names
Okay bestie, welcome to X509_GET_SUBJECT_NAME(3) from the Library Functions Manual. This one is literally cert-name surgery, and the vibes are administrative but make it β¨iconicβ¨.
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/x509.h>
X509_NAME *
X509_get_subject_name(const X509 *x);
int
X509_set_subject_name(X509 *x, X509_NAME *name);
X509_NAME *
X509_get_issuer_name(const X509 *x);
int
X509_set_issuer_name(X509 *x, X509_NAME *name);
X509_NAME *
X509_REQ_get_subject_name(const X509_REQ *req);
int
X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name);
X509_NAME *
X509_CRL_get_issuer(const X509_CRL *crl);
int
X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
π¦ DESCRIPTION π¦
So here's the group-chat rundown, bestie π
X509_get_subject_name()β returns the subject name of certificatex. The returned value is an internal pointer which must not be freed.
π¨ Do not free that returned internal pointer. It is not yours to free, bestie. Put thefree()down. Step away from thefree().
X509_set_subject_name()β sets the issuer name of certificatextoname. Thenameparameter is copied internally and should be freed up when it is no longer needed.
π Yes, the function is called set_subject_name and the sentence says issuer name. That is exactly what the page says. We are keeping the facts, not fixing the plot.
X509_get_issuer_name()andX509_set_issuer_name()β identical toX509_get_subject_name()andX509_set_subject_name()except that they get and set the issuer name ofx.- Similarly,
X509_REQ_get_subject_name(),X509_REQ_set_subject_name(),X509_CRL_get_issuer(), andX509_CRL_set_issuer_name()get or set the subject or issuer names of certificate requests of CRLs, respectively.
πΈ RETURN VALUES πΈ
X509_get_subject_name(),X509_get_issuer_name(),X509_REQ_get_subject_name(), andX509_CRL_get_issuer()return a pointer to anX509_NAMEobject. Slay πX509_set_subject_name(),X509_set_issuer_name(),X509_REQ_set_subject_name(), andX509_CRL_set_issuer_name()return1for success or0for failure. In some cases of failure, the reason can be determined withERR_get_error(3).
π SEE ALSO π
d2i_X509_NAME(3)X509_CRL_get0_by_serial(3)X509_CRL_new(3)X509_get_pubkey(3)X509_NAME_add_entry_by_txt(3)X509_NAME_ENTRY_get_object(3)X509_NAME_get_index_by_NID(3)X509_NAME_new(3)X509_NAME_print_ex(3)X509_new(3)X509_REQ_new(3)X509_sign(3)X509_verify_cert(3)X509V3_get_d2i(3)
π§ HISTORY π§
X509_get_subject_name()andX509_get_issuer_name()appeared in SSLeay 0.4 or earlier.X509_set_subject_name(),X509_set_issuer_name(),X509_REQ_get_subject_name(), andX509_REQ_set_subject_name()first appeared in SSLeay 0.6.5.- These functions have been available since OpenBSD 2.4.
X509_CRL_get_issuer()first appeared in OpenSSL 0.9.2b and has been available since OpenBSD 2.6.X509_CRL_set_issuer_name()first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2.
Mwah π this cutie pie page is from Debian, dated June 8, 2025 β go forth and name those certs, bestie πβ¨
π¦ 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) 2015 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms