asn1_decode_simple_ber(3)

πŸ“¦
version 4.21.0 Β· 5 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu resolute, ubuntu stonking

✨ asn1_decode_simple_ber ✨

okay bestie, so this is a page from the libtasn1 manual β€” like, the whole manual name is literally just libtasn1, no cap β€” and today's main character is the function asn1_decode_simple_ber. it's an API function. let's get into it πŸ’…


🌸 SYNOPSIS 🌸

#include <libtasn1.h>

int asn1_decode_simple_ber(unsigned int etype, const unsigned char *
der, unsigned int _der_len, unsigned char ** str, unsigned int *
str_len, unsigned int * ber_len);

there she is. iconic. screenshot it for later πŸ“Έ


πŸŽ€ ARGUMENTS πŸŽ€

  • unsigned int etype β€” the type of the string that's getting encoded, and it's one of the ASN1_ETYPE_ ones, iykyk
  • const unsigned char * der β€” the encoded string itself, the actual bytes bestie
  • unsigned int _der_len β€” how many bytes are in that encoded string
  • unsigned char ** str β€” a pointer to the data
  • unsigned int * str_len β€” the length of the data
  • unsigned int * ber_len β€” the total length occupied by BER, and lowkey this one may be NULL if you're not about that life

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it do. it decodes a BER encoded type, periodt. the output is an allocated value of the data β€” yes, allocated, she's yours to free, we don't make the rules 🌈

and here's the important bit, the vibe check: this decodes BER STRINGS only. literally only strings. any other type gets decoded as DER instead. so don't come at her expecting BER for your non-string types, she said no πŸ™ˆ


⭐ RETURNS ⭐

  • ASN1_SUCCESS if everything slayed ✨
  • or an error value, if it did not πŸ’€

Copyright Β© 2006-2025 Free Software Foundation, Inc..

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.

(that's the legal tea and we're keeping it exactly as-is, no edits, we respect the paperwork 🫢)


πŸ‘‘ SEE ALSO πŸ‘‘

the full documentation for libtasn1 lives in a Texinfo manual β€” yes, the whole thing. so if the info and libtasn1 programs are properly installed at your site, this command:

info libtasn1

should give you access to the complete manual. and if info isn't your thing, as an alternative you may obtain the manual from:

https://www.gnu.org/software/libtasn1/manual/

and that's the page, bestie!! this was libtasn1 version 4.21.0, manual section asn1_decode_simple_ber(3) β€” go forth, decode your BER strings, free your allocations, and stay hydrated πŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from