X509_GET0_DISTINGUISHING_ID(3ossl)

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

πŸ’… X509_GET0_DISTINGUISHING_ID β€” ngl bestie, this is the OpenSSL 3ossl glow-up you didn't know you needed πŸŽ€

okay so picture this: it's giving X509_GET0_DISTINGUISHING_ID(3ossl), straight out of the OpenSSL fam, and today we're learning how to get and set the Distinguishing ID for certificate operations. yes queen, it's a whole thing and it's lowkey iconic ✨


πŸ‘‘ NAME

X509_get0_distinguishing_id, X509_set0_distinguishing_id, X509_REQ_get0_distinguishing_id, X509_REQ_set0_distinguishing_id β€” get or set the Distinguishing ID for certificate operations. that's the whole vibe. no notes. πŸ’–


🌸 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);

like, copy-paste it, bestie, it's literally right there 🫢


πŸ¦‹ DESCRIPTION

so the Distinguishing ID is defined in FIPS 196 as:

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

basically it's the "who dis" of the authentication world. main character energy fr fr. πŸ”₯

the SM2 signature algorithm requires a Distinguishing ID value when generating and verifying a signature β€” but the Distinguishing ID may also find other uses. in the context of SM2, people often just call it the "SM2 ID". iykyk πŸ’…

now here's the cute part: for the purpose of verifying a certificate or a certification request, a Distinguishing ID may be attached to it, so functions like X509_verify(3) or X509_REQ_verify(3) have easy access to that identity for signature verification. it's giving personal assistant energy. πŸ’β€β™€οΈ


✨ the actual functions ✨

  • X509_get0_distinguishing_id() β€” gets the Distinguishing ID value of a certificate x by returning an ASN1_OCTET_STRING object which should not be freed by the caller. hands off, bestie, that's not yours πŸ‘
  • X509_set0_distinguishing_id() β€” assigns distid to the certificate x. calling this function transfers the memory management of the value to the X509 object, and therefore the value that has been passed in should not be freed by the caller after this function has been called. like, once you hand it over, it's not your baby anymore, it's the X509's baby 😭✨
  • X509_REQ_get0_distinguishing_id() and X509_REQ_set0_distinguishing_id() β€” same functionality as X509_get0_distinguishing_id() and X509_set0_distinguishing_id(), except that they deal with X509_REQ objects instead of X509. same energy, different type. periodt. πŸ‘‘

πŸ“ RETURN VALUES

X509_set0_distinguishing_id() and X509_REQ_set0_distinguishing_id() do not return a value. nothing. void. they just do the thing and dip. πŸ’€


🌈 SEE ALSO

go read those too, bestie, they're literally in the same friend group 🧚


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>.


⚠️ friendly reminder: memory management here is load-bearing. if you free a value after set0, the vibe check fails and things get spicy in the bad way. πŸ™ˆ

okay that's the whole page, hope you slayed πŸ’– this was OpenSSL 3.5.6, dated 2026-04-07, and yes the header was already spoiling it β€” X509_GET0_DISTINGUISHING_ID(3ossl). mwah. πŸŽ€πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from