~/bend-docscommunity

rules.bend checks

raw source on the hub · import 0xeb25eff332574f4f1d48668b83cdda30/rules.bend as Rules

bend-osdev-asn1, decoding rules: what a decoder accepts beyond the basic encoding rules' octet structure (ITU-T X.690 (02/2021)), each a parameter:

indefinite the indefinite length form (8.1.3.6) is accepted; DER refuses it (10.1) min_length lengths must take the fewest octets (DER, 10.1) forms the forms X.690 fixes for universal types are enforced: BOOLEAN, INTEGER, NULL, OBJECT IDENTIFIER, REAL, ENUMERATED and RELATIVE-OID are primitive (8.2.1, 8.3.1, 8.8.1, 8.19.1, 8.5.1, 8.4, 8.20.1); SEQUENCE and SET (and their -OF forms) constructed (8.9.1, 8.10.1, 8.11.1, 8.12.1) prim_strings bit strings, octet strings and restricted character string types (and UTCTime and GeneralizedTime, which are VisibleStrings, X.680 46.3 and 47.3) must be primitive (DER, 10.2) set_order the order of a SET's elements: none, the SET OF order (the encodings ascending as octet strings padded with zeros, 11.6), or the SET order (tags ascending in X.680 8.6's order, 10.3) trailing octets after the element are accepted (the caller's choice; X.690 does not say) values the typed readers apply DER's restrictions on values: BOOLEAN TRUE is FF (11.1), a bit string's unused bits are zero (11.2.1), times end in Z, keep their seconds and drop trailing fraction zeros (11.7, 11.8)

Asn1Rules.der() is DER, Asn1Rules.ber() BER; Asn1Rules.default() is DER.

2 imports
import Base
import ./tag.bend as T

Types

type Asn1SetOrder source · line 32 · raw

Data

type Asn1Rules source · line 37 · raw

Data

Definitions

def Asn1Rules.der source · line 40 · raw

Asn1Rules

def Asn1Rules.ber source · line 43 · raw

Asn1Rules

def Asn1Rules.default source · line 46 · raw

Asn1Rules

def Asn1Rules.indefinite source · line 49 · raw

@r:Asn1Rules -> Bool

def Asn1Rules.min_length source · line 54 · raw

@r:Asn1Rules -> Bool

def Asn1Rules.forms source · line 59 · raw

@r:Asn1Rules -> Bool

def Asn1Rules.prim_strings source · line 64 · raw

@r:Asn1Rules -> Bool

def Asn1Rules.set_order source · line 69 · raw

@r:Asn1Rules -> Asn1SetOrder

def Asn1Rules.trailing source · line 74 · raw

@r:Asn1Rules -> Bool

def Asn1Rules.values source · line 79 · raw

@r:Asn1Rules -> Bool

def Asn1Rules.with_trailing source · line 85 · raw

@r:Asn1Rules -> @t2:Bool -> Asn1Rules

the same rules with trailing octets accepted or not

def a1.mem source · line 92 · raw

@+n:Nat -> @xs:List<&2, Nat> -> Bool

def a1.prim_only source · line 100 · raw

List<&2, Nat>

universal types whose encoding is always primitive

def a1.cons_only source · line 104 · raw

List<&2, Nat>

universal types whose encoding is always constructed

def a1.strings source · line 108 · raw

List<&2, Nat>

bit and octet strings, restricted character strings and the time strings

def a1.when source · line 111 · raw

@on:Bool -> @ok:Bool -> Bool

def a1.form_univ source · line 118 · raw

@+r:Asn1Rules -> @+n:Nat -> @cons:Bool -> Bool

def a1.form_ok source · line 127 · raw

@+r:Asn1Rules -> @t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @cons:Bool -> Bool

whether rules r accept an element of this tag in this form (only universal tags have fixed forms)