gen_signature

package
v0.0.0-...-d1ba03b Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Code generated by ndn tlv codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T1

type T1 struct {
	//+field:natural
	H1 uint64 `tlv:"0x01"`

	//+field:natural:optional
	H2 optional.Optional[uint64] `tlv:"0x02"`
	//+field:wire
	C enc.Wire `tlv:"0x03"`
	//+field:signature:sigCoverStart:sigCovered
	Sig enc.Wire `tlv:"0x04"`

	//+field:natural:optional
	H3 optional.Optional[uint64] `tlv:"0x06"`
	// contains filtered or unexported fields
}

+tlv-model:nocopy,private,ordered

func ReadT1

func ReadT1(reader enc.WireView) (*T1, enc.Wire, error)

Parses a T1 object from the provided wire format, returning the parsed structure, the covered signature data, and any error encountered.

func (*T1) Encode

func (v *T1) Encode(estLen uint, value []byte) (enc.Wire, enc.Wire)

Encodes a signed data structure (e.g., Data packet) with the provided signature value, adjusting the signature field's length and returning both the full encoded wire and the signature-covered portion.

type T1Encoder

type T1Encoder struct {
	Length uint

	C_length    uint
	Sig_wireIdx int
	Sig_estLen  uint
	// contains filtered or unexported fields
}

func (*T1Encoder) Encode

func (encoder *T1Encoder) Encode(value *T1) enc.Wire

Encodes a T1 value into a structured byte slice layout defined by the encoder's wire plan, returning a segmented wire representation.

func (*T1Encoder) EncodeInto

func (encoder *T1Encoder) EncodeInto(value *T1, wire enc.Wire)

Encodes a T1 data structure into a wire format, handling required/optional fields, sequences of elements, and signature coverage tracking for cryptographic operations.

func (*T1Encoder) Init

func (encoder *T1Encoder) Init(value *T1)

Initializes the T1Encoder with calculated lengths and wire format offsets for encoding a T1 structure, accounting for optional fields (H2, H3), variable-length string slices (C), and signature data.

type T1ParsingContext

type T1ParsingContext struct {
	// contains filtered or unexported fields
}

func (*T1ParsingContext) Init

func (context *T1ParsingContext) Init()

Initializes the `sigCovered` field as an empty byte slice to store signature-covered data during parsing.

func (*T1ParsingContext) Parse

func (context *T1ParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*T1, error)

Parses a TLV-encoded T1 structure, processing fields in a defined order (H1, sigCoverStart, H2, C, Sig, sigCovered, H3), managing signature-coverage tracking, and enforcing presence of required fields unless critical fields are skipped with ignoreCritical.

type T2

type T2 struct {
	//+field:interestName:sigCovered
	Name enc.Name `tlv:"0x01"`

	//+field:wire
	C enc.Wire `tlv:"0x03"`
	//+field:signature:sigCoverStart:sigCovered
	Sig enc.Wire `tlv:"0x04"`
	// contains filtered or unexported fields
}

+tlv-model:nocopy,private,ordered

func ReadT2

func ReadT2(reader enc.WireView, digestRequired bool) (*T2, enc.Wire, error)

Parses a T2 structure from the provided wire format, verifies the SHA-256 digest in the name component if required, and returns the parsed T2 object along with the covered signature data.

func (*T2) Encode

func (v *T2) Encode(estLen uint, value []byte, needDigest bool) (enc.Wire, enc.Wire)

Encodes a T2 packet into NDN wire format, computing cryptographic signatures and name digests as specified.

type T2Encoder

type T2Encoder struct {
	Length uint

	Name_length     uint
	Name_needDigest bool
	Name_wireIdx    int
	Name_pos        uint

	C_length    uint
	Sig_wireIdx int
	Sig_estLen  uint
	// contains filtered or unexported fields
}

func (*T2Encoder) Encode

func (encoder *T2Encoder) Encode(value *T2) enc.Wire

Encodes a T2 value into a byte buffer partitioned according to the encoder's wire plan and returns the resulting wire segments.

func (*T2Encoder) EncodeInto

func (encoder *T2Encoder) EncodeInto(value *T2, wire enc.Wire)

Encodes a T2 data structure into NDN wire format, handling signature coverage tracking for Name, Content, and Signature fields while managing wire buffer indices and positions for subsequent signing/digest computation.

func (*T2Encoder) Init

func (encoder *T2Encoder) Init(value *T2)

Initializes the T2Encoder with the given T2 structure, calculates encoding lengths and offsets for name components, content (C), and signature (Sig), and prepares a wire encoding plan for TLV-based serialization.

type T2ParsingContext

type T2ParsingContext struct {
	Name_wireIdx int
	Name_pos     uint
	// contains filtered or unexported fields
}

func (*T2ParsingContext) Init

func (context *T2ParsingContext) Init()

Initializes the parsing context by resetting the signature-covered data to an empty encoded structure.

func (*T2ParsingContext) Parse

func (context *T2ParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*T2, error)

Parses a TLV-encoded NDN data structure into a T2 object, handling fields like Name, Content (C), and Signature (Sig), while tracking signature-covered regions for cryptographic verification.

Jump to

Keyboard shortcuts

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