asn1tools

package
v7.0.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package asn1tools provides tools for managing ASN1 marshaled data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddASNAppTag

func AddASNAppTag(b []byte, tag int) []byte

AddASNAppTag adds an ASN1 encoding application tag value to the raw bytes provided.

func GetLengthFromASN

func GetLengthFromASN(b []byte) int

GetLengthFromASN returns the length of a slice of ASN1 encoded bytes from the ASN1 length header it contains.

func GetNumberBytesInLengthHeader

func GetNumberBytesInLengthHeader(b []byte) int

GetNumberBytesInLengthHeader returns the number of bytes in the ASn1 header that indicate the length.

func MarshalLengthBytes

func MarshalLengthBytes(l int) []byte

MarshalLengthBytes returns the ASN1 encoded bytes for the length 'l'

There are two forms: short (for lengths between 0 and 127), and long definite (for lengths between 0 and 2^1008 -1).

Short form: One octet. Bit 8 has value "0" and bits 7-1 give the length.

Long form: Two to 127 octets. Bit 8 of first octet has value "1" and bits 7-1 give the number of additional length octets. Second and following octets give the length, base 256, most significant digit first.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL