asn1

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal[S Serializer](values ...S) ([]byte, error)

Marshal marshals the passed serializers into a single byte slice.

func MarshalMath

func MarshalMath(values ...element) ([]byte, error)

MarshalMath marshals the passed elements into a single byte slice.

func MarshalStd

func MarshalStd(a any) ([]byte, error)

MarshalStd marshals the passed value using standard ASN.1 encoding.

func NewArray

func NewArray[S Serializer](values []S) (*array[S], error)

NewArray returns a new Serializer representing an array of serializers.

func NewArrayWithNew

func NewArrayWithNew[S Serializer](newFunction func() S) (*array[S], error)

NewArrayWithNew returns a new Serializer representing an array of serializers created by the provided function.

func NewElementArray

func NewElementArray[E element](factors []E) (element, error)

NewElementArray returns a new element representing an array of elements.

func NewUnmarshaller

func NewUnmarshaller(raw []byte) (*unmarshaller, error)

NewUnmarshaller returns a new unmarshaller for the passed byte slice.

func Unmarshal

func Unmarshal[S Serializer](data []byte, values ...S) error

Unmarshal unmarshals the passed byte slice into the provided serializers.

func UnmarshalTo

func UnmarshalTo[S Serializer](data []byte, newFunction func() S) ([]S, error)

UnmarshalTo unmarshals the passed byte slice into a slice of serializers created by the provided function.

Types

type Element

type Element struct {
	CurveID int
	Raw     []byte
}

Element represents a serialized element with a curve ID.

type Serializer

type Serializer interface {
	Serialize() ([]byte, error)
	Deserialize([]byte) error
}

Serializer defines an interface for serializing and deserializing values.

type Values

type Values struct {
	Values [][]byte
}

Values represents a list of serialized values.

Jump to

Keyboard shortcuts

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