ike

package
v0.0.143 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ike provides shared IKE (Internet Key Exchange) protocol parsing and packet-building utilities used by both the discover and enumerate modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUnique

func AppendUnique(slice []string, item string) []string

AppendUnique appends item to slice only if it is not already present.

func BuildIKEv2SAInitRequest

func BuildIKEv2SAInitRequest() []byte

BuildIKEv2SAInitRequest creates a minimal IKEv2 IKE_SA_INIT request packet. Use this for the standard IKE port (UDP 500).

func BuildNATTIKEv2SAInitRequest

func BuildNATTIKEv2SAInitRequest() []byte

BuildNATTIKEv2SAInitRequest creates an IKEv2 IKE_SA_INIT request framed for UDP port 4500 per RFC 3948 §2.3: a 4-byte Non-ESP marker (0x00000000) is prepended so the receiver can distinguish IKE traffic from ESP packets.

func GetDHGroupName

func GetDHGroupName(id uint16) string

GetDHGroupName returns the IANA name for an IKEv2 Diffie-Hellman group ID (RFC 7296 / IANA "IKEv2 Transform Type 4" registry).

func GetEncryptionAlgorithmName

func GetEncryptionAlgorithmName(id uint16) string

GetEncryptionAlgorithmName returns the IANA name for an IKEv2 encryption transform ID (RFC 7296 / IANA "IKEv2 Transform Type 1" registry).

func GetExchangeTypeName

func GetExchangeTypeName(t byte) string

GetExchangeTypeName returns the human-readable name for an IKE exchange type.

func GetIntegrityAlgorithmName

func GetIntegrityAlgorithmName(id uint16) string

GetIntegrityAlgorithmName returns the IANA name for an IKEv2 integrity transform ID (RFC 7296 / IANA "IKEv2 Transform Type 3" registry).

func GetPRFName

func GetPRFName(id uint16) string

GetPRFName returns the IANA name for an IKEv2 PRF transform ID (RFC 7296 / IANA "IKEv2 Transform Type 2" registry).

func ParseSAPayload

func ParseSAPayload(data []byte, proposals *SecurityProposals)

ParseSAPayload extracts transform attributes from an IKEv2 SA payload, correctly skipping any per-proposal SPI bytes before the transform list.

Types

type IKEHeader

type IKEHeader struct {
	InitiatorSPI [8]byte
	ResponderSPI [8]byte
	NextPayload  byte
	MajorVersion byte
	MinorVersion byte
	ExchangeType byte
	Flags        byte
	MessageID    uint32
	Length       uint32
}

IKEHeader represents the parsed 28-byte IKE message header.

func ParseIKEHeader

func ParseIKEHeader(data []byte) (*IKEHeader, error)

ParseIKEHeader parses the 28-byte IKE message header.

type SecurityProposals

type SecurityProposals struct {
	EncryptionAlgs []string
	HashAlgs       []string
	AuthMethods    []string
	DHGroups       []string
}

SecurityProposals holds parsed IKE security association proposals.

func ParseIKEPayloads

func ParseIKEPayloads(data []byte, nextPayload byte) ([]string, *SecurityProposals)

ParseIKEPayloads extracts vendor IDs (hex-encoded) and SA proposals from the payload section of an IKE message. nextPayload is taken from the IKE header.

Jump to

Keyboard shortcuts

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