internal

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package internal provides shared internal utilities for the CMS package.

Package internal provides shared internal utilities for the CMS package.

Index

Constants

View Source
const (
	SigTypeCMS     = "cms"
	OpSign         = "sign"
	OpVerify       = "verify"
	KeyTypePublic  = "public"
	KeyTypePrivate = "private"
)

Signature and operation type constants

View Source
const (
	// MaxSignatureSize is the maximum allowed CMS signature size (1MB)
	// This prevents memory exhaustion attacks from malformed signatures
	MaxSignatureSize = 1024 * 1024

	// MaxCertSize is the maximum allowed certificate size (64KB)
	// Standard X.509 certificates are typically 1-4KB
	MaxCertSize = 64 * 1024
)

Size limits for CMS structures

Variables

This section is empty.

Functions

func MarshalImplicitHeader

func MarshalImplicitHeader(length int) []byte

MarshalImplicitHeader creates an IMPLICIT [0] tag header with the given length. Returns the DER-encoded tag and length bytes for IMPLICIT [0] (tag 0xA0).

func MarshalSafe

func MarshalSafe(v interface{}) ([]byte, error)

MarshalSafe wraps asn1.Marshal with explicit error checking. This helper is used throughout the CMS package to ensure all ASN.1 encoding operations properly handle errors.

func MarshalSequenceHeader

func MarshalSequenceHeader(length int) []byte

MarshalSequenceHeader creates a SEQUENCE header with the given length. Returns the DER-encoded tag and length bytes for a SEQUENCE.

func MarshalSetHeader

func MarshalSetHeader(length int) []byte

MarshalSetHeader creates a SET header with the given length. Returns the DER-encoded tag and length bytes for a SET.

Types

This section is empty.

Jump to

Keyboard shortcuts

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