const CLASS_UNIVERSAL
pub const CLASS_UNIVERSAL = 0用途
常量 CLASS_UNIVERSAL,定义了相关的协议或算法配置参数。
#encoding/asn1DER TLV 编解码;INTEGER 拟合 i64。
const CLASS_UNIVERSALpub const CLASS_UNIVERSAL = 0常量 CLASS_UNIVERSAL,定义了相关的协议或算法配置参数。
const CLASS_CONTEXTpub const CLASS_CONTEXT = 2常量 CLASS_CONTEXT,定义了相关的协议或算法配置参数。
const TAG_BOOLEANpub const TAG_BOOLEAN = 1常量 TAG_BOOLEAN,定义了相关的协议或算法配置参数。
const TAG_INTEGERpub const TAG_INTEGER = 2常量 TAG_INTEGER,定义了相关的协议或算法配置参数。
const TAG_BIT_STRINGpub const TAG_BIT_STRING = 3常量 TAG_BIT_STRING,定义了相关的协议或算法配置参数。
const TAG_OCTET_STRINGpub const TAG_OCTET_STRING = 4常量 TAG_OCTET_STRING,定义了相关的协议或算法配置参数。
const TAG_NULLpub const TAG_NULL = 5常量 TAG_NULL,定义了相关的协议或算法配置参数。
const TAG_OIDpub const TAG_OID = 6常量 TAG_OID,定义了相关的协议或算法配置参数。
const TAG_UTF8_STRINGpub const TAG_UTF8_STRING = 12常量 TAG_UTF8_STRING,定义了相关的协议或算法配置参数。
const TAG_SEQUENCEpub const TAG_SEQUENCE = 16常量 TAG_SEQUENCE,定义了相关的协议或算法配置参数。
const TAG_SETpub const TAG_SET = 17常量 TAG_SET,定义了相关的协议或算法配置参数。
const TAG_PRINTABLE_STRINGpub const TAG_PRINTABLE_STRING = 19常量 TAG_PRINTABLE_STRING,定义了相关的协议或算法配置参数。
const TAG_IA5_STRINGpub const TAG_IA5_STRING = 22常量 TAG_IA5_STRING,定义了相关的协议或算法配置参数。
const TAG_UTC_TIMEpub const TAG_UTC_TIME = 23常量 TAG_UTC_TIME,定义了相关的协议或算法配置参数。
const TAG_GENERALIZED_TIMEpub const TAG_GENERALIZED_TIME = 24常量 TAG_GENERALIZED_TIME,定义了相关的协议或算法配置参数。
struct Valuepub struct Value {
pub class int
pub constructed int
pub tag int
pub bytes string
pub rest string
}承载 class、constructed、tag、bytes、rest 等属性的结构体。
class intconstructed inttag intbytes stringrest stringstruct Decoderpub struct Decoder {
pub data string
pub pos int
}承载 data、pos 等属性的结构体。
data stringpos intnew_decoderpub fn new_decoder(data &string) Decoder构造 decoder。
data &stringDecoder — 该类型的值
marshal_boolpub fn marshal_bool(v bool) string执行 marshal bool 操作。
v boolstring — 结果字符串
marshal_nullpub fn marshal_null() string编码写出空设备。
无需传入参数。
string — 结果字符串
marshal_octetpub fn marshal_octet(s &string) string执行 marshal octet 操作。
s &stringstring — 结果字符串
marshal_utf8pub fn marshal_utf8(s &string) string编码写出utf8。
s &stringstring — 结果字符串
marshal_bit_stringpub fn marshal_bit_string(s &string) string执行 marshal bit string 操作。
s &stringstring — 结果字符串
marshal_intpub fn marshal_int(n int) string执行 marshal int 操作。
n intstring — 结果字符串
marshal_oidpub fn marshal_oid(arcs &[]int) string执行 marshal oid 操作。失败时抛出错误,调用方需处理或继续传播。
arcs &[]intstring — 结果字符串
marshal_seqpub fn marshal_seq(elems &[]string) string执行 marshal seq 操作。
elems &[]stringstring — 结果字符串
unmarshalpub fn unmarshal(data &string) Value解码读入。失败时抛出错误,调用方需处理或继续传播。
data &stringValue — 该类型的值
parse_atpub fn parse_at(data &string, off int) Value解析为 at。失败时抛出错误,调用方需处理或继续传播。
data &stringoff intValue — 该类型的值
(Decoder) donepub fn (d Decoder) done() boolDecoder 上的操作:完成一项。
d DecoderDecoder 实例;按值接收。bool — 是否成立
(Value) as_bit_stringpub fn (v Value) as_bit_string() stringValue 上的操作:执行 as bit string 操作。失败时抛出错误,调用方需处理或继续传播。
v ValueValue 实例;按值接收。string — 结果字符串
($&Decoder) nextpub fn (d $&Decoder) next() Value$&Decoder 上的操作:取出下一项;没有则按本类型约定结束。失败时抛出错误,调用方需处理或继续传播。
d $&DecoderDecoder 实例;以独占借用传入,方法可修改它,调用方仍持有实例。Value — 该类型的值
(Value) as_boolpub fn (v Value) as_bool() boolValue 上的操作:执行 as bool 操作。失败时抛出错误,调用方需处理或继续传播。
v ValueValue 实例;按值接收。bool — 是否成立
(Value) as_intpub fn (v Value) as_int() intValue 上的操作:执行 as int 操作。失败时抛出错误,调用方需处理或继续传播。
v ValueValue 实例;按值接收。int — 该类型的值
(Value) as_octetpub fn (v Value) as_octet() stringValue 上的操作:执行 as octet 操作。失败时抛出错误,调用方需处理或继续传播。
v ValueValue 实例;按值接收。string — 结果字符串
(Value) as_utf8pub fn (v Value) as_utf8() stringValue 上的操作:执行 as utf8 操作。失败时抛出错误,调用方需处理或继续传播。
v ValueValue 实例;按值接收。string — 结果字符串
(Value) as_nullpub fn (v Value) as_null() boolValue 上的操作:执行 as null 操作。失败时抛出错误,调用方需处理或继续传播。
v ValueValue 实例;按值接收。bool — 是否成立
(Value) as_oidpub fn (v Value) as_oid() []intValue 上的操作:执行 as oid 操作。失败时抛出错误,调用方需处理或继续传播。
v ValueValue 实例;按值接收。[]int — 切片结果