string.bend checks
raw source on the hub · import 0xeb25eff332574f4f1d48668b83cdda30/string.bend as MString
bend-osdev-asn1, the restricted character string types (ITU-T X.680 (02/2021) clause 41, Table 8; encoded per X.690 (02/2021) 8.23): their contents octets, checked against each type's characters, and as Unicode code points:
UTF8String (12) UTF-8, checked against RFC 3629 (November 2003) section 4's syntax NumericString (18) digits and space (X.680 Table 9) PrintableString (19) X.680 Table 10's characters TeletexString (20) any octets; read as code points 0-255 (the T.61 repertoire is not mapped) IA5String (22) octets 0-127 (registrations 1 and 6) VisibleString (26) octets 32-126 (registration 6 and SPACE) UniversalString (28) four octets per character, big-endian BMPString (30) two octets per character, big-endian
7 imports
import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import ./error.bend as E import ./tag.bend as T import ./node.bend as N import ./rules.bend as R import ./prim.bend as P
Types
type Asn1StrKind source · line 24 · raw
Data
Asn1Utf8Asn1StrKind
Asn1NumericAsn1StrKind
Asn1PrintableAsn1StrKind
Asn1TeletexAsn1StrKind
Asn1Ia5Asn1StrKind
Asn1VisibleAsn1StrKind
Asn1UniversalStrAsn1StrKind
Asn1BmpAsn1StrKind
type Asn1Str source · line 34 · raw
Data
Asn1Str@kind:Asn1StrKind -> @octets:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Asn1Str
type A1U8 source · line 37 · raw
Data
A1U8@need:Nat -> @lo:U32 -> @hi:U32 -> @cp:U32 -> A1U8
A1U8BadA1U8
type A1U8Step source · line 41 · raw
Data
A1U8Step@st:A1U8 -> @emit:Maybe<&2, U32> -> A1U8Step
Definitions
def Asn1StrKind.num source · line 44 · raw
@k:Asn1StrKind -> Nat
def Asn1StrKind.tag source · line 63 · raw
@k:Asn1StrKind -> 0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag
def a1.kind.of_num source · line 66 · raw
@n:Nat -> Maybe<&2, Asn1StrKind>
def Asn1StrKind.of_tag source · line 88 · raw
@t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> Maybe<&2, Asn1StrKind>
the string type of a tag, if it is one
def a1.u8.in source · line 99 · raw
@+x:U32 -> @lo:U32 -> @hi:U32 -> Bool
def a1.u8.lead source · line 102 · raw
@a1b:Bool -> @a2:Bool -> @e0:Bool -> @e1:Bool -> @ed:Bool -> @ee:Bool -> @f0:Bool -> @f1:Bool -> @f4:Bool -> @+x:U32 -> A1U8Step
def a1.u8.start source · line 125 · raw
@+x:U32 -> A1U8Step
def a1.u8.tail source · line 128 · raw
@ok:Bool -> @k:Nat -> @+cp:U32 -> @+x:U32 -> A1U8Step
def a1.u8.step source · line 139 · raw
@st:A1U8 -> @+x:U32 -> A1U8Step
def a1.u8.st source · line 148 · raw
@s:A1U8Step -> A1U8
def a1.u8.acc source · line 153 · raw
@s:A1U8Step -> @acc:List<&2, U32> -> List<&2, U32>
def a1.u8.done source · line 160 · raw
@st:A1U8 -> @acc:List<&2, U32> -> Maybe<&2, List<&2, U32>>
def a1.u8.go source · line 167 · raw
@xs:List<&2, U32> -> @st:A1U8 -> @acc:List<&2, U32> -> Maybe<&2, List<&2, U32>>
def Asn1.utf8_decode source · line 176 · raw
@xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>
the code points of UTF-8 octets; None if they are not UTF-8
def a1.u8.cont source · line 179 · raw
@c:U32 -> @k:Nat -> U32
def a1.u8.enc.pick source · line 182 · raw
@a:Bool -> @b:Bool -> @d:Bool -> @+c:U32 -> List<&2, U32>
def a1.u8.enc1 source · line 193 · raw
@+c:U32 -> List<&2, U32>
def Asn1.utf8_encode source · line 197 · raw
@cs:List<&2, U32> -> List<&2, U32>
code points as UTF-8 octets
def a1.printable source · line 206 · raw
@+x:U32 -> Bool
def a1.numeric source · line 209 · raw
@+x:U32 -> Bool
def a1.charset source · line 212 · raw
@k:Asn1StrKind -> @+x:U32 -> Bool
def a1.all_in source · line 231 · raw
@xs:List<&2, U32> -> @+k:Asn1StrKind -> Bool
def a1.ok_chars source · line 238 · raw
@ok:Bool -> @+xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>
def a1.wide.put source · line 247 · raw
@ok:Bool -> @c:U32 -> @r:Maybe<&2, List<&2, U32>> -> Maybe<&2, List<&2, U32>>
def a1.wide.cons source · line 254 · raw
@+c:U32 -> @lo:U32 -> @hi:U32 -> @r:Maybe<&2, List<&2, U32>> -> Maybe<&2, List<&2, U32>>
def a1.bmp source · line 257 · raw
@xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>
def a1.wide.cons4 source · line 266 · raw
@+c:U32 -> @r:Maybe<&2, List<&2, U32>> -> Maybe<&2, List<&2, U32>>
def a1.ucs4 source · line 269 · raw
@xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>
def Asn1.points_text source · line 279 · raw
@cs:List<&2, U32> -> String
code points as text
def a1.chars source · line 287 · raw
@k:Asn1StrKind -> @+xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>
the code points of a string's octets; None if they are not its type's
def Asn1Str.chars source · line 306 · raw
@s:Asn1Str -> Maybe<&2, List<&2, U32>>
def Asn1Str.text source · line 312 · raw
@s:Asn1Str -> String
the string's characters as text ("" if it is not valid)
def Asn1Str.valid source · line 315 · raw
@s:Asn1Str -> Bool
def Asn1.string source · line 320 · raw
@s:Asn1Str -> 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node
def a1.text_points source · line 325 · raw
@s:String -> List<&2, U32>
def Asn1.utf8 source · line 333 · raw
@s:String -> 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node
a UTF8String of text
def a1.str.mk source · line 336 · raw
@ok:Bool -> @k:Asn1StrKind -> @xs:List<&2, U32> -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>
def Asn1.text_string source · line 345 · raw
@+k:Asn1StrKind -> @s:String -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>
a one-octet-per-character string of text (Asn1BadString for a character the type does not have)
def a1.str.check.pick source · line 349 · raw
@ok:Bool -> @s:Asn1Str -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, Asn1Str>
def a1.str.check source · line 356 · raw
@+s:Asn1Str -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, Asn1Str>
def a1.str.got source · line 359 · raw
@k:Asn1StrKind -> @r:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets> -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, Asn1Str>
def a1.str.read source · line 366 · raw
@m:Maybe<&2, Asn1StrKind> -> @+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @n:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, Asn1Str>
def Asn1.get_string source · line 375 · raw
@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+n:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, Asn1Str>
a character string element: its type and contents (BER segments joined), checked against the type's characters
def Asn1.get_string_as source · line 380 · raw
@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+k:Asn1StrKind -> @n:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, Asn1Str>
a character string element of one type (an IMPLICIT tag t, contents of type k)