esp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NextHeaderIPv4 = 4
	NextHeaderIPv6 = 41
)

Variables

View Source
var (
	ErrInvalidSA     = errors.New("invalid esp sa")
	ErrInvalidPacket = errors.New("invalid esp packet")
	ErrReplay        = errors.New("esp replay detected")
)

Functions

This section is empty.

Types

type EncryptionAlgorithm

type EncryptionAlgorithm uint16

type IntegrityAlgorithm

type IntegrityAlgorithm uint16

type OpenResult

type OpenResult struct {
	SPI        uint32
	Sequence   uint32
	NextHeader uint8
	Payload    []byte
}

type SA

type SA struct {
	SPI              uint32
	Encryption       EncryptionAlgorithm
	EncryptionKey    []byte
	IntegrityKey     []byte
	Integrity        IntegrityAlgorithm
	ICVLength        int
	BlockSize        int
	Sequence         uint32
	HighestSequence  uint32
	ReplayWindowSize uint32
	ReplayBitmap     uint64
}

func NewInboundSAFromChild

func NewInboundSAFromChild(child ikev2.ChildSAResult) (*SA, error)

func NewOutboundSAFromChild

func NewOutboundSAFromChild(child ikev2.ChildSAResult) (*SA, error)

func NewSA

func NewSA(sa SA) (*SA, error)

func (*SA) Open

func (s *SA) Open(packet []byte) (OpenResult, error)

func (*SA) Seal

func (s *SA) Seal(nextHeader uint8, payload []byte, opts SealOptions) ([]byte, error)

type SealOptions

type SealOptions struct {
	Sequence uint32
	IV       []byte
	Random   io.Reader
}

Jump to

Keyboard shortcuts

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