X509_GET0_DISTINGUISHING_ID(3ossl)

πŸ’– NAME πŸ’–

okay bestie, gather round, because this one is literally the Distinguishing ID page ✨

  • X509_get0_distinguishing_id, X509_set0_distinguishing_id β€” get or set the Distinguishing ID for certificate operations πŸŽ€
  • X509_REQ_get0_distinguishing_id, X509_REQ_set0_distinguishing_id β€” same energy, but for cert requests πŸ¦‹

so like, it's the X509_GET0_DISTINGUISHING_ID(3ossl) manual, and yes, four whole functions live here, no cap.


✨ SYNOPSIS ✨

#include <openssl/x509.h>

ASN1_OCTET_STRING *X509_get0_distinguishing_id(X509 *x);
void X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *distid);
ASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x);
void X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *distid);

look at that symmetry, it's giving ✨matched set✨ πŸ’…


🌸 DESCRIPTION 🌸

So. The Distinguishing ID is defined in FIPS 196, and here's the literal definition, bestie:

Distinguishing identifier β€” Information which unambiguously distinguishes an entity in the authentication process.

iconic. no notes. 🫢

The SM2 signature algorithm requires a Distinguishing ID value when it's generating and verifying a signature, but the Distinguishing ID may also find other uses, so don't box it in. When we're talking SM2 specifically, the Distinguishing ID is often just called the "SM2 ID" β€” iykyk. 🧚

Now, for the purpose of verifying a certificate or a certification request, a Distinguishing ID may be attached to it, so that functions like X509_verify(3) or X509_REQ_verify(3) have easy access to that identity for signature verification. basically we're handing them the identity on a lil platter so they don't have to go digging πŸ”₯

Here's who does what:

  • X509_get0_distinguishing_id() β€” gets the Distinguishing ID value of a certificate x by returning an ASN1_OCTET_STRING object. Do NOT free it, bestie. The caller must not free it. πŸ™ˆ
  • X509_set0_distinguishing_id() β€” assigns distid to the certificate x. Here's the tea: calling this function transfers the memory management of the value to the X509 object. So the value you passed in should not be freed by the caller after this function has been called. it's not yours anymore, you gave it away πŸ’€
  • X509_REQ_get0_distinguishing_id() and X509_REQ_set0_distinguishing_id() β€” literally the same functionality as X509_get0_distinguishing_id() and X509_set0_distinguishing_id(), except they deal with X509_REQ objects instead of X509. same vibe, different struct πŸ’œ

πŸ‘‘ RETURN VALUES πŸ‘‘

  • X509_set0_distinguishing_id() and X509_REQ_set0_distinguishing_id() do not return a value.

that's it, that's the whole section, they're void and they're at peace with it ⭐


🌈 SEE ALSO 🌈

go read those next, bestie, they're the sequel πŸ“š


Copyright 2019-2020 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>.


and that's the whole page, periodt πŸ’… this was OpenSSL manual page X509_GET0_DISTINGUISHING_ID(3ossl), version 3.5.9, dated 2026-09-29 β€” mwah, take care of your octet strings and don't double-free, ily πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from