V2I_ASN1_BIT_STRING(3)
okay bestie, welcome to V2I_ASN1_BIT_STRING(3) from the Library Functions Manual β this is the page for the ASN.1 BIT STRING utility functions for certificate extensions. π
π NAME π
v2i_ASN1_BIT_STRING, i2v_ASN1_BIT_STRING β ASN.1 BIT STRING utility functions for certificate extensions
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/x509v3.h>
ASN1_BIT_STRING *
v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
STACK_OF(CONF_VALUE) *nval);
STACK_OF(CONF_VALUE) *
i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
ASN1_BIT_STRING *bit_string, STACK_OF(CONF_VALUE) *nval);
π DESCRIPTION π
okay so v2i_ASN1_BIT_STRING() is the glow-up machine: it allocates a brand-new ASN.1 BIT STRING object and initializes it from a list of bit names. The nval argument is basically used as the list of the names of the bits to set. Both long names and short names can be used, bestie. One name is taken from each element of nval. The ctx argument and any section names or values contained in the elements of nval are ignored. To convert a C string containing a comma-separated list of names to the input format of this function, X509V3_parse_list(3) can be used.
Next up, i2v_ASN1_BIT_STRING() does the reverse translation: it translates the numbers of the bits that are set in the bit_string to long names. For each bit that is set, one element containing the corresponding long name is added to nval. If a NULL pointer is passed for the nval argument, a new STACK_OF(CONF_VALUE) is allocated. iconic behavior honestly β¨
For both functions, the method argument is only used for the translation of bit names to bit numbers and vice versa. Any names and bit numbers that do not occur in the usr_data translation table in the method are silently ignored β no error, no drama, they just vanish. π
For the following arguments, X509V3_EXT_get_nid(3) returns static constant method objects supporting these functions:
NID_crl_reasonβ reason codes, RFC 5280 section 5.3.1NID_key_usageβ key usage purposes, RFC 5280 section 4.2.1.3NID_netscape_cert_typeβ Netscape certificate types (obsolete)
While an application program could theoretically provide its own method object containing a custom translation table, that is unlikely to be useful for any practical purpose. like, theoretically? sure. practically? not the vibe. π
π RETURN VALUES π
v2i_ASN1_BIT_STRING() returns the new BIT STRING object, and i2v_ASN1_BIT_STRING() returns the modified or new list of bit names. Both functions return NULL if an error occurs, in particular if memory allocation fails. So if you see NULL, check your memory situation, bestie. π
π¦ SEE ALSO π¦
ASN1_BIT_STRING_new(3)ASN1_BIT_STRING_set(3)i2s_ASN1_ENUMERATED_TABLE(3)STACK_OF(3)tls_peer_ocsp_crl_reason(3)X509_get_key_usage(3)X509V3_EXT_get_nid(3)X509V3_get_d2i(3)X509V3_parse_list(3)
π HISTORY π
These functions first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5. history was made, periodt. β¨
mwah π this page is from Debian, dated June 8, 2025, and the page title is V2I_ASN1_BIT_STRING(3). bye 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) 2024 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms