GNUTLS_X509_CRT_GET_SUBJECT_ALT_NAME(3)
π gnutls_x509_crt_get_subject_alt_name(3) π
okay bestie, so this one lives in the gnutls manual β yeah, the whole gnutls documentation set, and this page is literally titled gnutls_x509_crt_get_subject_alt_name. it's an API function, which is just a fancy way of saying "a function you can call from your C code" π«Ά
β¨ NAME β¨
gnutls_x509_crt_get_subject_alt_name β API function. that's it, that's the name, no notes π
π SYNOPSIS π
like, here's how you summon it:
#include <gnutls/x509.h>
int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt_t cert,
unsigned int seq, void * san, size_t * san_size, unsigned int *
critical);
the include goes at the top, the function goes wherever you need it, slay πΈ
π¦ ARGUMENTS π¦
gnutls_x509_crt_t certβ this should contain agnutls_x509_crt_ttype. it's the certificate you're poking at, basically the main character of this whole operation πunsigned int seqβ specifies the sequence number of the alt name.0for the first one,1for the second etc. so like, indexing. zero-indexed. iconic behaviour fr fr β¨void * sanβ is the place where the alternative name will be copied to. so you bring the buffer, it fills the buffer πsize_t * san_sizeβ holds the size ofsan. you tell it how much room you've got, it tells you how much it actually needed πunsigned int * criticalβ will be non-zero if the extension is marked as critical. may be null, so it's optional, no pressure, lowkey chill about it π
π DESCRIPTION π
so what does it actually do. this function retrieves the Alternative Name (2.5.29.17), contained in the given certificate in the X509v3 Certificate Extensions. the SAN. the moment. the legend β
now here's the tea: when the SAN type is otherName, it will extract the data in the otherName's value field, and GNUTLS_SAN_OTHERNAME is returned. you may use gnutls_x509_crt_get_subject_alt_othername_oid() to get the corresponding OID and the "virtual" SAN types (e.g., GNUTLS_SAN_OTHERNAME_XMPP). virtual types?? in my SAN?? it's giving layers π
if an otherName OID is known, the data will be decoded. otherwise the returned data will be DER encoded, and you will have to decode it yourself. so like, you're on your own for that one, bestie, no cap π currently, only the RFC 3920 id-on-xmppAddr SAN is recognized. just the one. the chosen one. the only child π
π₯ RETURNS π₯
it returns the alternative subject name type on success, one of the enumerated gnutls_x509_subject_alt_name_t. periodt β¨
but also:
- it will return
GNUTLS_E_SHORT_MEMORY_BUFFERifsan_sizeis not large enough to hold the value. in that casesan_sizewill be updated with the required size. so like, it tells you how much bigger to go. helpful king π - if the certificate does not have an Alternative name with the specified sequence number then
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned. not there. doesn't exist. we looked. nothing. π
π REPORTING BUGS π
found a bug? don't suffer in silence, tell the people:
- Report bugs to <bugs@gnutls.org>.
- Home page: https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
so yes you can copy it, just keep the receipts π§
π SEE ALSO π
The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form visit
https://www.gnutls.org/manual/
like if it's not on your machine, it's on the internet. it's fine. we got you π
and that's the whole page, bestie π this one came from the gnutls manual, page gnutls_x509_crt_get_subject_alt_name(3), version 3.8.13 β go read your SANs, you're gonna do amazing, i'm obsessed π«Άπβ¨
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms