亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

annuaire recherche
archive archive/tar archive/zip bufio bufio(緩存) builtin builtin(內(nèi)置包) bytes bytes(包字節(jié)) compress compress/bzip2(壓縮/bzip2) compress/flate(壓縮/flate) compress/gzip(壓縮/gzip) compress/lzw(壓縮/lzw) compress/zlib(壓縮/zlib) container container/heap(容器數(shù)據(jù)結(jié)構(gòu)heap) container/list(容器數(shù)據(jù)結(jié)構(gòu)list) container/ring(容器數(shù)據(jù)結(jié)構(gòu)ring) context context(上下文) crypto crypto(加密) crypto/aes(加密/aes) crypto/cipher(加密/cipher) crypto/des(加密/des) crypto/dsa(加密/dsa) crypto/ecdsa(加密/ecdsa) crypto/elliptic(加密/elliptic) crypto/hmac(加密/hmac) crypto/md5(加密/md5) crypto/rand(加密/rand) crypto/rc4(加密/rc4) crypto/rsa(加密/rsa) crypto/sha1(加密/sha1) crypto/sha256(加密/sha256) crypto/sha512(加密/sha512) crypto/subtle(加密/subtle) crypto/tls(加密/tls) crypto/x509(加密/x509) crypto/x509/pkix(加密/x509/pkix) database database/sql(數(shù)據(jù)庫(kù)/sql) database/sql/driver(數(shù)據(jù)庫(kù)/sql/driver) debug debug/dwarf(調(diào)試/dwarf) debug/elf(調(diào)試/elf) debug/gosym(調(diào)試/gosym) debug/macho(調(diào)試/macho) debug/pe(調(diào)試/pe) debug/plan9obj(調(diào)試/plan9obj) encoding encoding(編碼) encoding/ascii85(編碼/ascii85) encoding/asn1(編碼/asn1) encoding/base32(編碼/base32) encoding/base64(編碼/base64) encoding/binary(編碼/binary) encoding/csv(編碼/csv) encoding/gob(編碼/gob) encoding/hex(編碼/hex) encoding/json(編碼/json) encoding/pem(編碼/pem) encoding/xml(編碼/xml) errors errors(錯(cuò)誤) expvar expvar flag flag(命令行參數(shù)解析flag包) fmt fmt go go/ast(抽象語(yǔ)法樹(shù)) go/build go/constant(常量) go/doc(文檔) go/format(格式) go/importer go/parser go/printer go/scanner(掃描儀) go/token(令牌) go/types(類(lèi)型) hash hash(散列) hash/adler32 hash/crc32 hash/crc64 hash/fnv html html html/template(模板) image image(圖像) image/color(顏色) image/color/palette(調(diào)色板) image/draw(繪圖) image/gif image/jpeg image/png index index/suffixarray io io io/ioutil log log log/syslog(日志系統(tǒng)) math math math/big math/big math/bits math/bits math/cmplx math/cmplx math/rand math/rand mime mime mime/multipart(多部分) mime/quotedprintable net net net/http net/http net/http/cgi net/http/cookiejar net/http/fcgi net/http/httptest net/http/httptrace net/http/httputil net/http/internal net/http/pprof net/mail net/mail net/rpc net/rpc net/rpc/jsonrpc net/smtp net/smtp net/textproto net/textproto net/url net/url os os os/exec os/signal os/user path path path/filepath(文件路徑) plugin plugin(插件) reflect reflect(反射) regexp regexp(正則表達(dá)式) regexp/syntax runtime runtime(運(yùn)行時(shí)) runtime/debug(調(diào)試) runtime/internal/sys runtime/pprof runtime/race(競(jìng)爭(zhēng)) runtime/trace(執(zhí)行追蹤器) sort sort(排序算法) strconv strconv(轉(zhuǎn)換) strings strings(字符串) sync sync(同步) sync/atomic(原子操作) syscall syscall(系統(tǒng)調(diào)用) testing testing(測(cè)試) testing/iotest testing/quick text text/scanner(掃描文本) text/tabwriter text/template(定義模板) text/template/parse time time(時(shí)間戳) unicode unicode unicode/utf16 unicode/utf8 unsafe unsafe
personnages

  • import "encoding/asn1"

  • 概述

  • 索引

概述

按照 ITU-T Rec X.690 的規(guī)定,asn1 包實(shí)現(xiàn)了對(duì) DER 編碼的 ASN.1 數(shù)據(jù)結(jié)構(gòu)的解析。

另見(jiàn)“ ASN.1,BER 和 DER 子集的外行指南”,http://luca.ntop.org/Teaching/Appunti/asn1.html。

索引

  • 常量

  • 變量

  • func Marshal(val interface{}) ([]byte, error)

  • func Unmarshal(b []byte, val interface{}) (rest []byte, err error)

  • func UnmarshalWithParams(b []byte, val interface{}, params string) (rest []byte, err error)

  • type BitString

  • func (b BitString) At(i int) int

  • func (b BitString) RightAlign() []byte

  • type Enumerated

  • type Flag

  • type ObjectIdentifier

  • func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool

  • func (oi ObjectIdentifier) String() string

  • type RawContent

  • type RawValue

  • type StructuralError

  • func (e StructuralError) Error() string

  • type SyntaxError

  • func (e SyntaxError) Error() string

包文件

asn1.go common.go marshal.go

常量

ASN.1 標(biāo)簽表示以下對(duì)象的類(lèi)型。

const (
        TagBoolean         = 1
        TagInteger         = 2
        TagBitString       = 3
        TagOctetString     = 4
        TagNull            = 5
        TagOID             = 6
        TagEnum            = 10
        TagUTF8String      = 12
        TagSequence        = 16
        TagSet             = 17
        TagPrintableString = 19
        TagT61String       = 20
        TagIA5String       = 22
        TagUTCTime         = 23
        TagGeneralizedTime = 24
        TagGeneralString   = 27)

ASN.1 類(lèi)類(lèi)型表示標(biāo)簽的名稱(chēng)空間。

const (
        ClassUniversal       = 0
        ClassApplication     = 1
        ClassContextSpecific = 2
        ClassPrivate         = 3)

變量

NullBytes 包含表示 DER 編碼的 ASN.1 NULL 類(lèi)型的字節(jié)。

var NullBytes = []byte{TagNull, 0}

NullRawValue 是一個(gè) RawValue,其標(biāo)簽設(shè)置為 ASN.1 NULL 類(lèi)型 tag(5)。

var NullRawValue = RawValue{Tag: TagNull}

func Marshal

func Marshal(val interface{}) ([]byte, error)

Marshal 返回 val 的 ASN.1 編碼。

除了由 Unmarshal 識(shí)別的結(jié)構(gòu)標(biāo)簽之外,還可以使用以下內(nèi)容:

ia5:導(dǎo)致字符串被封送為ASN.1,IA5String值
omitempty:導(dǎo)致跳過(guò)空切片
printable:導(dǎo)致字符串被封送為ASN.1,PrintableString值
utf8:導(dǎo)致字符串被封送為ASN.1,UTF8String值
utc:導(dǎo)致time.Time被封送為ASN.1,UTCTime值
generalized:導(dǎo)致time.Time被封送為ASN.1,GeneralizedTime值

func Unmarshal

func Unmarshal(b []byte, val interface{}) (rest []byte, err error)

Unmarshal 分析 DER 編碼的 ASN.1 數(shù)據(jù)結(jié)構(gòu) b 并使用反射包填充 val 指向的任意值。由于 Unmarshal 使用反射包,因此寫(xiě)入的結(jié)構(gòu)必須使用大寫(xiě)字段名稱(chēng)。

ASN.1 INTEGER 可以寫(xiě)入 int,int32,int64 或 *big.Int(來(lái)自 math/big package)。如果編碼值不適合 Go 類(lèi)型,Unmarshal 會(huì)返回解析錯(cuò)誤。

一個(gè) ASN.1 BIT STRING 可以寫(xiě)入一個(gè) BitString。

ASN.1 OCTET STRING 可以寫(xiě)入 []byte。

一個(gè) ASN.1 OBJECT IDENTIFIER 可以寫(xiě)入一個(gè) ObjectIdentifier。

一個(gè) ASN.1 枚舉可以被寫(xiě)入枚舉。

一次 ASN.1 UTCTIME 或 GENERALIZEDTIME 可寫(xiě)入一次。

ASN.1 PrintableString 或 IA5String 可寫(xiě)入字符串。

任何上面的 ASN.1 值都可以寫(xiě)入 interface{}。存儲(chǔ)在接口中的值具有相應(yīng)的 Go 類(lèi)型。對(duì)于整數(shù),該類(lèi)型是 int64。

如果可以將 x 寫(xiě)入片段的元素類(lèi)型,則可以將 x 或 x 的 ASN.1 序列寫(xiě)入片段。

如果可以將序列中的每個(gè)元素寫(xiě)入結(jié)構(gòu)中的相應(yīng)元素,則可以將 ASN.1 SEQUENCE 或 SET 寫(xiě)入結(jié)構(gòu)。

結(jié)構(gòu)字段上的以下標(biāo)記對(duì) Unmarshal 具有特殊意義:

application指定使用APPLICATION標(biāo)記default:x設(shè)置可選整數(shù)字段的默認(rèn)值(僅在可選的整數(shù)字段存在時(shí)使用)
explicit指定附加的顯式標(biāo)記包裝隱式標(biāo)記
可選標(biāo)記該字段為ASN.1可選set會(huì)導(dǎo)致SET,而不是SEQUENCE類(lèi)型
tag:x指定ASN.1標(biāo)記號(hào); 暗示ASN.1特定背景

如果結(jié)構(gòu)的第一個(gè)字段的類(lèi)型是 RawContent,那么該結(jié)構(gòu)的原始 ASN1 內(nèi)容將被存儲(chǔ)在其中。

如果一個(gè)切片元素的類(lèi)型名稱(chēng)以“SET”結(jié)尾,那么它將被視為設(shè)置了“set”標(biāo)簽。這可以用于無(wú)法給出 struct 標(biāo)記的嵌套切片。

其他 ASN.1 類(lèi)型不受支持;如果遇到,Unmarshal 將返回一個(gè)分析錯(cuò)誤。

func UnmarshalWithParams

func UnmarshalWithParams(b []byte, val interface{}, params string) (rest []byte, err error)

UnmarshalWithParams 允許為頂層元素指定字段參數(shù)。參數(shù)的形式與字段標(biāo)簽相同。

type BitString

當(dāng)您需要 ASN.1 BIT STRING 類(lèi)型時(shí),BitString 是要使用的結(jié)構(gòu)。位串被填充到內(nèi)存中最近的字節(jié)并記錄有效位的數(shù)量。填充位將為零。

type BitString struct {
        Bytes     []byte // 比特打包成字節(jié)。
        BitLength int    // 比特長(zhǎng)度。}

func (BitString) At

func (b BitString) At(i int) int

返回給定索引處的位。如果索引超出范圍,則返回 false。

func (BitString) RightAlign

func (b BitString) RightAlign() []byte

RightAlign 返回填充位在開(kāi)始位置的片。切片可以與 BitString 共享內(nèi)存。

type Enumerated

Enumerated 被表示為一個(gè)純(plain) int。

type Enumerated int

type Flag

Flag 接受任何數(shù)據(jù),如果存在則設(shè)置為 true。

type Flag bool

type ObjectIdentifier

一個(gè) ObjectIdentifier 表示一個(gè) ASN.1 對(duì)象標(biāo)識(shí)符。

type ObjectIdentifier []int

func (ObjectIdentifier) Equal

func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool

平等報(bào)告 oi 和其他是否表示相同的標(biāo)識(shí)符。

func (ObjectIdentifier) String

func (oi ObjectIdentifier) String() string

type RawContent

RawContent 用于表示未解碼的 DER 數(shù)據(jù)需要為結(jié)構(gòu)體保留。要使用它,結(jié)構(gòu)的第一個(gè)字段必須有這種類(lèi)型。任何其他字段都有這種類(lèi)型的錯(cuò)誤。

type RawContent []byte

type RawValue

一個(gè) RawValue 表示一個(gè)未解碼的 ASN.1 對(duì)象。

type RawValue struct {
        Class, Tag int
        IsCompound bool
        Bytes      []byte
        FullBytes  []byte // 包括標(biāo)簽和長(zhǎng)度}

type StructuralError

StructuralError 表明 ASN.1 數(shù)據(jù)是有效的,但是接收它的 Go 類(lèi)型不匹配。

type StructuralError struct {
        Msg string}

func (StructuralError) Error

func (e StructuralError) Error() string

type SyntaxError

SyntaxError 表明 ASN.1 數(shù)據(jù)無(wú)效。

type SyntaxError struct {
        Msg string}

func (SyntaxError) Error

func (e SyntaxError) Error() string
Article précédent: Article suivant: