Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Supported ASN.1 and limitations

What vest_asn1 accepts today. Anything listed as not supported is rejected by the compiler with an error.

Primitive types

TypeSupportNotes
BOOLEANSupported
INTEGERSupportedsupport for arbitrary-width big integers; constraint INTEGER specializes to the narrow i8 or i16 backend
ENUMERATEDSupportedsupported as a constraint on INTEGER (specialized to i16)
NULLSupported
OBJECT IDENTIFIERSupportedas a type; not as a value assignment
REALSupportedas a type; not as a value assignment
OCTET STRINGSupported
BIT STRINGPartially supportedno SIZE constraints
ANYPartially supportedno ANY DEFINED BY dispatch
UTF8StringSupported
PrintableStringSupported
IA5StringSupported
NumericStringSupported
TeletexStringPartially supportedcharacter-set validation is currently a stub
BMPStringSupportedno borrowed forms, always owned
UniversalStringSupportedno borrowed forms, always owned
UTCTimeSupported
GeneralizedTimeSupported
GeneralStringNot supported
VisibleString / ISO646StringNot supported
GraphicString, VideotexString, T61StringNot supported
RELATIVE-OIDNot supported
ObjectDescriptor, EXTERNAL, EMBEDDED PDVNot supported
DATE, TIME, DURATIONNot supported

Constructed types

TypeSupportNotes
SEQUENCESupported
SEQUENCE OFSupported
SET OFSupportedordering rules differ by encoding rule — see below
CHOICESupported
SETPartially supportedDER only, and fields must already be in canonical tag order in the schema
Anonymous inline compositesSupportedlifted to private helper definitions
Recursive schemaNot supported

Tagging

FeatureSupportNotes
EXPLICIT tagsSupported
IMPLICIT tagsSupportedreplaces the outer tag
Context-specific, application, private classesSupported
IMPLICIT on CHOICE or ANYSupportedpromoted to explicit — neither has one tag to replace
AUTOMATIC TAGSNot supported

Components and constraints

FeatureSupportNotes
OPTIONALSupported
DEFAULTPartially supportedBOOLEAN, ENUMERATED, and INTEGER whose range fits in i8/i16
SIZE — fixed, bounded, one-sidedSupportedon strings and collections; not on BIT STRING
INTEGER value and range constraintsSupported
WITH COMPONENTSNot supported
Extension markers (...)Not supported
Extension-addition groupsNot supported

Module-level

FeatureSupportNotes
Local type referencesSupported
BOOLEAN, INTEGER, ENUMERATED value assignmentsSupportedemitted as typed Rust constants
OBJECT IDENTIFIER, REAL value assignmentsNot supported
Imports from other modulesNot supportedmodule linking is unimplemented; curate dependencies into one module instead

Additional notes

SET OF ordering. DER requires the values to be sorted by their complete DER TLV encoding. The generated prepare rejects an unsorted vector without allocating, so sorting is the caller’s job (the provided comparison abstraction is non-allocating so sorting should be efficient as well). Duplicate encodings are allowed. BER SET OF imposes no canonical order and preserves schema order on output.

Heterogeneous SET. BER lets a SET carry its components in any order, so a BER parser would have to accept every permutation of the fields. DER instead fixes them in ascending tag order. vest_asn1 currently emits SET only under DER, and only when the schema already lists the fields in canonical order. The vest_lib backend supports a group of Permute combinators that can be used to implement BER SET, but the generator does not yet emit them.

Borrowing and alloc. DER strings are contiguous, so their value types borrow from the input. BER strings may arrive fragmented across constructed encodings and are flattened into owned values, which is why BER modules need the alloc feature where the equivalent DER module may not. BMPString and UniversalString are always owned, since their wire form is not UTF-8.

High tag numbers and disjointness. CHOICE, OPTIONAL, and DEFAULT need alternatives/adjacent fields to be provably disjoint. The generated proof covers the 256 possible leading identifier octets: tags 0 through 30 are exact, but all high-tag-number forms sharing a class and constructed bit collapse onto one bit. Two such tags cannot be proven disjoint from their later tag-number octets alone, so a schema that distinguishes alternatives only by high tag numbers is conservatively rejected.