package asn1tools

import "github.com/jcmturner/gokrb5/v8/asn1tools"

Package asn1tools provides tools for managing ASN1 marshaled data.

Index

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.

Source Files

tools.go

Version
v8.4.3
Published
Jul 27, 2022
Platform
js/wasm
Imports
1 packages
Last checked
3 hours ago

Tools for package owners.