QSC Post Quantum Cryptographic Library 1.3.0.0 (C1)
A post quantum secure library written in Ansi C
Loading...
Searching...
No Matches
qsc_encoding_ber_element Struct Reference

In-memory representation of a single BER/DER ASN.1 TLV element. More...

#include <encoding.h>

Data Fields

uint8_t tagclass
bool constructed
uint32_t tagnumber
bool indefinite
size_t length
uint8_t * value
struct qsc_encoding_ber_element ** children
size_t ccount

Detailed Description

In-memory representation of a single BER/DER ASN.1 TLV element.

An element is either:

Primitive
The raw value octets are stored in value and length reflects their count. children is NULL and ccount is 0.
Constructed (definite-length)
For elements created by the encoder with a pre-encoded content block, value holds that block and length reflects its byte count. For elements produced by the decoder, children holds pointers to individually decoded child elements and length reflects the total content byte count (not including tag/length overhead of this element).
Constructed (indefinite-length BER only)
indefinite is true. The decoder populates children with all elements found before the EOC marker; the encoder iterates children and appends the 0x00 0x00 EOC pair. DER rejects indefinite-length encoding at both encode and decode time.
Warning
The children array is heap-allocated and owned by this element. Always release element trees with qsc_encoding_ber_free_element to avoid memory leaks.

Field Documentation

◆ ccount

size_t ccount

Number of valid pointers in children.

◆ children

struct qsc_encoding_ber_element** children

Heap-allocated array of child element pointers; valid only for constructed types when decoded into individual child elements.

◆ constructed

bool constructed

true if the element is constructed (contains child elements); false if primitive.

◆ indefinite

bool indefinite

true if the length was encoded in indefinite form (BER only); false for definite form.

◆ length

size_t length

For primitive elements: number of bytes in value. For constructed elements: total content byte count (excluding the tag and length header of this node).

◆ tagclass

uint8_t tagclass

Tag class: one of QSC_ENCODING_BER_CLASS_UNIVERSAL, QSC_ENCODING_BER_CLASS_APPLICATION, QSC_ENCODING_BER_CLASS_CONTEXT_SPECIFIC, or QSC_ENCODING_BER_CLASS_PRIVATE.

◆ tagnumber

uint32_t tagnumber

Tag number. Values < 31 use short-form tag encoding; values >= 31 use long-form (base-128).

◆ value

uint8_t* value

Pointer to the raw value bytes for primitive elements, or the pre-encoded content block for definite-length constructed elements. NULL for constructed elements decoded from child streams.


The documentation for this struct was generated from the following file:
  • C:/Users/stepp/Documents/Visual Studio 2022/Projects/C/QSC/QSC/encoding.h