X509_REQ_NEW(3)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

Okay bestie, welcome to the X509_REQ_NEW(3) page from the Library Functions Manual β€” manual name folded in right here, no boring header line, periodt πŸ’…

This whole page is about PKCS#10 certification requests, and the main-character function squad is:

  • X509_REQ_new
  • X509_REQ_dup
  • X509_to_X509_REQ
  • X509_REQ_free
  • X509_REQ_INFO_new
  • X509_REQ_INFO_free

🌸 SYNOPSIS 🌸

No cap, here’s the exact code vibe:

#include <openssl/x509.h>

X509_REQ *
X509_REQ_new(void);

X509_REQ *
X509_REQ_dup(X509_REQ *req);

X509_REQ *
X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);

void
X509_REQ_free(X509_REQ *req);

X509_REQ_INFO *
X509_REQ_INFO_new(void);

void
X509_REQ_INFO_free(X509_REQ_INFO *req_info);

✨ DESCRIPTION ✨

Okay so here’s the tea, function by function β˜• Stay with me, it’s actually so good.

  • X509_REQ_new() β€” allocates and initializes an empty X509_REQ object, representing an ASN.1 CertificationRequest structure defined in RFC 2986 section 4.2. It can hold a pointer to an X509_REQ_INFO object discussed below together with a cryptographic signature and information about the signature algorithm used. Fresh empty request object energy, fr fr ✨
  • X509_REQ_dup() β€” creates a deep copy of req using ASN1_item_dup(3), setting the reference count of the copy to 1. Deep copy, reference count 1, no sharing drama πŸ’…
  • X509_to_X509_REQ() β€” allocates a new certification request object, copies the subject name and the public key into it from the certificate x, and sets the version to zero. Unless pkey is NULL, it also signs the request with X509_REQ_sign(3) using pkey and md. It’s giving β€œturn my cert into a request,” and it signs when you hand it a pkey πŸŽ€
  • X509_REQ_free() β€” frees req. If req is a NULL pointer, no action occurs. Free it and move on; NULL gets a little shrug, no action 🫢
  • X509_REQ_INFO_new() β€” allocates and initializes an empty X509_REQ_INFO object, representing an ASN.1 CertificationRequestInfo structure defined in RFC 2986 section 4.1. It is used inside the X509_REQ object and can hold the subject and the public key of the requested certificate and additional attributes. This is the inner info baddie that lives inside X509_REQ πŸ‘‘
  • X509_REQ_INFO_free() β€” frees req_info. If req_info is a NULL pointer, no action occurs. Same NULL-safe free energy: no action, no problem πŸ¦‹

🫢 RETURN VALUES 🫢

Okay, the return-value vibe check: X509_REQ_new(), X509_REQ_dup(), X509_to_X509_REQ(), and X509_REQ_INFO_new() return the new X509_REQ or X509_REQ_INFO object, respectively, or NULL if an error occurs.

So: object = slay, NULL = error 😭


πŸ‘‘ SEE ALSO πŸ‘‘

Your required-reading group chat, all exact:


🌈 STANDARDS 🌈

The standard repping this page: RFC 2986: PKCS #10: Certification Request Syntax Specification.


πŸ¦‹ HISTORY πŸ¦‹

Ancient lore time, bestie:

X509_REQ_new(), X509_REQ_free(), X509_REQ_INFO_new(), and X509_REQ_INFO_free() first appeared in SSLeay 0.4.4, X509_REQ_dup() in SSLeay 0.5.1, and X509_to_X509_REQ() in SSLeay 0.6.0. These functions have been available since OpenBSD 2.4.

Yes, that old. Yes, still iconic. Periodt πŸ’…

And that’s the whole page, bestie πŸ’… This one is brought to you by Debian, dated October 29, 2021, and filed under X509_REQ_NEW(3) β€” mwah πŸ’‹
πŸ“¦ where this page comes from