XU XUv0.16.0

#encoding/asn1

import: #encoding/asn1

counts: 11 functions, 9 methods, 2 types, 15 constants, 0 method sets

DER TLV; INTEGER fits in i64.

const CLASS_UNIVERSAL

XuAPI
pub const CLASS_UNIVERSAL = 0

Purpose

Constant CLASS_UNIVERSAL, defining protocol or algorithm parameters.

const CLASS_CONTEXT

XuAPI
pub const CLASS_CONTEXT = 2

Purpose

Constant CLASS_CONTEXT, defining protocol or algorithm parameters.

const TAG_BOOLEAN

XuAPI
pub const TAG_BOOLEAN = 1

Purpose

Constant TAG_BOOLEAN, defining protocol or algorithm parameters.

const TAG_INTEGER

XuAPI
pub const TAG_INTEGER = 2

Purpose

Constant TAG_INTEGER, defining protocol or algorithm parameters.

const TAG_BIT_STRING

XuAPI
pub const TAG_BIT_STRING = 3

Purpose

Constant TAG_BIT_STRING, defining protocol or algorithm parameters.

const TAG_OCTET_STRING

XuAPI
pub const TAG_OCTET_STRING = 4

Purpose

Constant TAG_OCTET_STRING, defining protocol or algorithm parameters.

const TAG_NULL

XuAPI
pub const TAG_NULL = 5

Purpose

Constant TAG_NULL, defining protocol or algorithm parameters.

const TAG_OID

XuAPI
pub const TAG_OID = 6

Purpose

Constant TAG_OID, defining protocol or algorithm parameters.

const TAG_UTF8_STRING

XuAPI
pub const TAG_UTF8_STRING = 12

Purpose

Constant TAG_UTF8_STRING, defining protocol or algorithm parameters.

const TAG_SEQUENCE

XuAPI
pub const TAG_SEQUENCE = 16

Purpose

Constant TAG_SEQUENCE, defining protocol or algorithm parameters.

const TAG_SET

XuAPI
pub const TAG_SET = 17

Purpose

Constant TAG_SET, defining protocol or algorithm parameters.

const TAG_PRINTABLE_STRING

XuAPI
pub const TAG_PRINTABLE_STRING = 19

Purpose

Constant TAG_PRINTABLE_STRING, defining protocol or algorithm parameters.

const TAG_IA5_STRING

XuAPI
pub const TAG_IA5_STRING = 22

Purpose

Constant TAG_IA5_STRING, defining protocol or algorithm parameters.

const TAG_UTC_TIME

XuAPI
pub const TAG_UTC_TIME = 23

Purpose

Constant TAG_UTC_TIME, defining protocol or algorithm parameters.

const TAG_GENERALIZED_TIME

XuAPI
pub const TAG_GENERALIZED_TIME = 24

Purpose

Constant TAG_GENERALIZED_TIME, defining protocol or algorithm parameters.

struct Value

XuAPI
pub struct Value {
    pub class int
    pub constructed int
    pub tag int
    pub bytes string
    pub rest string
}

Purpose

Structure encapsulating class, constructed, tag, bytes, rest.

Public fields

class int
field (int)
constructed int
field (int)
tag int
field (int)
bytes string
field (string)
rest string
field (string)

struct Decoder

XuAPI
pub struct Decoder {
    pub data string
    pub pos int
}

Purpose

Structure encapsulating data, pos.

Public fields

data string
data
pos int
field (int)

new_decoder

XuAPI
pub fn new_decoder(data &string) Decoder

Purpose

Construct decoder.

Parameters

data &string
data (read-only borrow; caller keeps the original; type &string)

Returns

Decoder — a value of this type

marshal_bool

XuAPI
pub fn marshal_bool(v bool) string

Purpose

Marshal bool.

Parameters

v bool
value (bool)

Returns

string — result string

marshal_null

XuAPI
pub fn marshal_null() string

Purpose

Marshal null.

Parameters

No arguments are required.

Returns

string — result string

marshal_octet

XuAPI
pub fn marshal_octet(s &string) string

Purpose

Marshal octet.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_utf8

XuAPI
pub fn marshal_utf8(s &string) string

Purpose

Marshal utf8.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_bit_string

XuAPI
pub fn marshal_bit_string(s &string) string

Purpose

Marshal bit string.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_int

XuAPI
pub fn marshal_int(n int) string

Purpose

Marshal int.

Parameters

n int
count, length, or limit (int)

Returns

string — result string

marshal_oid

XuAPI
pub fn marshal_oid(arcs &[]int) string

Purpose

Marshal oid. Throws on failure; handle the error or propagate it to the caller.

Parameters

arcs &[]int
arcs (read-only borrow; caller keeps the original; type &[]int)

Returns

string — result string

marshal_seq

XuAPI
pub fn marshal_seq(elems &[]string) string

Purpose

Marshal seq.

Parameters

elems &[]string
elems (read-only borrow; caller keeps the original; type &[]string)

Returns

string — result string

unmarshal

XuAPI
pub fn unmarshal(data &string) Value

Purpose

Execute unmarshal. Throws on failure; handle the error or propagate it to the caller.

Parameters

data &string
data (read-only borrow; caller keeps the original; type &string)

Returns

Value — a value of this type

parse_at

XuAPI
pub fn parse_at(data &string, off int) Value

Purpose

Parse as at. Throws on failure; handle the error or propagate it to the caller.

Parameters

data &string
data (read-only borrow; caller keeps the original; type &string)
off int
offset (int)

Returns

Value — a value of this type

(Decoder) done

XuAPI
pub fn (d Decoder) done() bool

Purpose

Execute done on Decoder.

Parameters

d Decoder
The Decoder instance used by this call (value receiver).

Returns

bool — true or false

(Value) as_bit_string

XuAPI
pub fn (v Value) as_bit_string() string

Purpose

Operation on Value: as bit string. Throws on failure; handle the error or propagate it to the caller.

Parameters

v Value
The Value instance used by this call (value receiver).

Returns

string — result string

($&Decoder) next

XuAPI
pub fn (d $&Decoder) next() Value

Purpose

Operation on $&Decoder: take the next item, or end according to this type. Throws on failure; handle the error or propagate it to the caller.

Parameters

d $&Decoder
The Decoder instance used by this call (exclusive borrow).

Returns

Value — a value of this type

(Value) as_bool

XuAPI
pub fn (v Value) as_bool() bool

Purpose

Operation on Value: as bool. Throws on failure; handle the error or propagate it to the caller.

Parameters

v Value
The Value instance used by this call (value receiver).

Returns

bool — true or false

(Value) as_int

XuAPI
pub fn (v Value) as_int() int

Purpose

Operation on Value: as int. Throws on failure; handle the error or propagate it to the caller.

Parameters

v Value
The Value instance used by this call (value receiver).

Returns

int — a value of this type

(Value) as_octet

XuAPI
pub fn (v Value) as_octet() string

Purpose

Operation on Value: as octet. Throws on failure; handle the error or propagate it to the caller.

Parameters

v Value
The Value instance used by this call (value receiver).

Returns

string — result string

(Value) as_utf8

XuAPI
pub fn (v Value) as_utf8() string

Purpose

Operation on Value: as utf8. Throws on failure; handle the error or propagate it to the caller.

Parameters

v Value
The Value instance used by this call (value receiver).

Returns

string — result string

(Value) as_null

XuAPI
pub fn (v Value) as_null() bool

Purpose

Operation on Value: as null. Throws on failure; handle the error or propagate it to the caller.

Parameters

v Value
The Value instance used by this call (value receiver).

Returns

bool — true or false

(Value) as_oid

XuAPI
pub fn (v Value) as_oid() []int

Purpose

Operation on Value: as oid. Throws on failure; handle the error or propagate it to the caller.

Parameters

v Value
The Value instance used by this call (value receiver).

Returns

[]int — slice result