~/bend-docscommunity

oidval.bend checks

raw source on the hub · import 0xeb25eff332574f4f1d48668b83cdda30/oidval.bend as Oidval

bend-osdev-asn1, OBJECT IDENTIFIER contents (ITU-T X.690 (02/2021) 8.19): subidentifiers in base-128 octets, bit 8 set on all but the last octet of each, each in the fewest octets (its leading octet not 80 hex, 8.19.2); the first subidentifier is 40 * X + Y for the first two arcs X and Y (8.19.4), the others the remaining arcs in order (8.19.5). An object identifier has at least two arcs, the first 0, 1 or 2, and the second below 40 when the first is 0 or 1 (8.19.4's note: 0 and 1 have at most 39 arcs beneath them).

Arcs are natural numbers of any size. The oid package builds the registry, the dotted text form and the DER form on these.

6 imports
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import ./error.bend as E
import ./number.bend as Nu
import ./tag.bend as T
import ./node.bend as N

Definitions

def a1.oid.second_ok source · line 19 · raw

@+x:Nat -> @+y:Nat -> Bool

def a1.oid.valid2 source · line 22 · raw

@+x:Nat -> @+y:Nat -> Bool

def a1.oid.small source · line 26 · raw

@ss:List<&2, Nat> -> Bool

every subidentifier has at most six base-128 octets (number.bend's bound)

def a1.oid.valid source · line 33 · raw

@arcs:List<&2, Nat> -> Bool

def a1.oid.to_subids source · line 41 · raw

@arcs:List<&2, Nat> -> List<&2, Nat>

the subidentifiers of arcs (the first two folded into one)

def Asn1.oid_valid source · line 51 · raw

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

whether arcs name an object identifier (two arcs or more, the first two within X.690 8.19.4's bounds) that this implementation can hold (each subidentifier below 2^42)

def a1.oid.subids source · line 55 · raw

@ss:List<&2, Nat> -> List<&2, U32>

the subidentifiers' octets

def a1.oid.content.pick source · line 62 · raw

@ok:Bool -> @+arcs:List<&2, Nat> -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets>

def Asn1.oid_content source · line 71 · raw

@+arcs:List<&2, Nat> -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets>

the contents octets of an object identifier (Asn1BadOid for arcs that do not name one)

def a1.oid.cons source · line 76 · raw

@s:Nat -> @r:Maybe<&2, List<&2, Nat>> -> Maybe<&2, List<&2, Nat>>

def a1.oid.one source · line 83 · raw

@ok:Bool -> @+s:Nat -> @rest:List<&2, U32> -> @more:Maybe<&2, List<&2, Nat>> -> Maybe<&2, List<&2, Nat>>

def a1.oid.read source · line 94 · raw

@fuel:Nat -> @m:Maybe<&2, 0xeb25eff332574f4f1d48668b83cdda30/number.A1Num> -> Maybe<&2, List<&2, Nat>>

the subidentifiers, from the first read on (each must be minimal); fuel bounds them, as each takes an octet or more

def a1.oid.split2 source · line 104 · raw

@lt40:Bool -> @lt80:Bool -> @+s:Nat -> @rest:List<&2, Nat> -> List<&2, Nat>

the first subidentifier as the first two arcs (8.19.4)

def a1.oid.arcs source · line 113 · raw

@m:Maybe<&2, List<&2, Nat>> -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, List<&2, Nat>>

def Asn1.oid_of_content source · line 122 · raw

@o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, List<&2, Nat>>

the arcs of an object identifier's contents octets (Asn1BadOid for none, a truncated subidentifier, or one not in the fewest octets)

def Asn1.oid source · line 129 · raw

@+arcs:List<&2, Nat> -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>

the OBJECT IDENTIFIER element of arcs

def Asn1.get_oid source · line 133 · raw

@n:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, List<&2, Nat>>

the arcs of an OBJECT IDENTIFIER element