message

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NoNext = 0
	TypeSA = iota + 32
	TypeKE
	TypeIDi
	TypeIDr
	TypeCERT
	TypeCERTreq
	TypeAUTH
	TypeNiNr
	TypeN
	TypeD
	TypeV
	TypeTSi
	TypeTSr
	TypeSK
	TypeCP
	TypeEAP
)
View Source
const (
	EAPTypeIdentity = iota + 1
	EAPTypeNotification
	EAPTypeNak
	EAPTypeExpanded = 254
)
View Source
const (
	EAPCodeRequest = iota + 1
	EAPCodeResponse
	EAPCodeSuccess
	EAPCodeFailure
)
View Source
const (
	TypeEncryptionAlgorithm = iota + 1
	TypePseudorandomFunction
	TypeIntegrityAlgorithm
	TypeDiffieHellmanGroup
	TypeExtendedSequenceNumbers
)

used for SecurityAssociation-Proposal-Transform TransformType

View Source
const (
	AttributeFormatUseTLV = iota
	AttributeFormatUseTV
)

used for SecurityAssociation-Proposal-Transform AttributeFormat

View Source
const (
	ENCR_DES_IV64 = 1
	ENCR_DES      = 2
	ENCR_3DES     = 3
	ENCR_RC5      = 4
	ENCR_IDEA     = 5
	ENCR_CAST     = 6
	ENCR_BLOWFISH = 7
	ENCR_3IDEA    = 8
	ENCR_DES_IV32 = 9
	ENCR_NULL     = 11
	ENCR_AES_CBC  = 12
	ENCR_AES_CTR  = 13
)

used for SecurityAssociation-Proposal-Transform TransformID

View Source
const (
	PRF_HMAC_MD5 = iota + 1
	PRF_HMAC_SHA1
	PRF_HMAC_TIGER
)
View Source
const (
	AUTH_NONE = iota
	AUTH_HMAC_MD5_96
	AUTH_HMAC_SHA1_96
	AUTH_DES_MAC
	AUTH_KPDK_MD5
	AUTH_AES_XCBC_96
)
View Source
const (
	DH_NONE          = 0
	DH_768_BIT_MODP  = 1
	DH_1024_BIT_MODP = 2
	DH_1536_BIT_MODP = 5
	DH_2048_BIT_MODP = iota + 10
	DH_3072_BIT_MODP
	DH_4096_BIT_MODP
	DH_6144_BIT_MODP
	DH_8192_BIT_MODP
)
View Source
const (
	ESN_NO = iota
	ESN_NEED
)
View Source
const (
	TS_IPV4_ADDR_RANGE = 7
	TS_IPV6_ADDR_RANGE = 8
)

used for TrafficSelector-Individual Traffic Selector TSType

View Source
const (
	IKE_SA_INIT = iota + 34
	IKE_AUTH
	CREATE_CHILD_SA
	INFORMATIONAL
)

Exchange Type

View Source
const (
	UNSUPPORTED_CRITICAL_PAYLOAD  = 1
	INVALID_IKE_SPI               = 4
	INVALID_MAJOR_VERSION         = 5
	INVALID_SYNTAX                = 7
	INVALID_MESSAGE_ID            = 9
	INVALID_SPI                   = 11
	NO_PROPOSAL_CHOSEN            = 14
	INVALID_KE_PAYLOAD            = 17
	AUTHENTICATION_FAILED         = 24
	SINGLE_PAIR_REQUIRED          = 34
	NO_ADDITIONAL_SAS             = 35
	INTERNAL_ADDRESS_FAILURE      = 36
	FAILED_CP_REQUIRED            = 37
	TS_UNACCEPTABLE               = 38
	INVALID_SELECTORS             = 39
	TEMPORARY_FAILURE             = 43
	CHILD_SA_NOT_FOUND            = 44
	INITIAL_CONTACT               = 16384
	SET_WINDOW_SIZE               = 16385
	ADDITIONAL_TS_POSSIBLE        = 16386
	IPCOMP_SUPPORTED              = 16387
	NAT_DETECTION_SOURCE_IP       = 16388
	NAT_DETECTION_DESTINATION_IP  = 16389
	COOKIE                        = 16390
	USE_TRANSPORT_MODE            = 16391
	HTTP_CERT_LOOKUP_SUPPORTED    = 16392
	REKEY_SA                      = 16393
	ESP_TFC_PADDING_NOT_SUPPORTED = 16394
	NON_FIRST_FRAGMENTS_ALSO      = 16395
)

Notify message types

View Source
const (
	TypeNone = iota
	TypeIKE
	TypeAH
	TypeESP
)

Protocol ID

View Source
const (
	ResponseBitCheck  = 0x20
	VersionBitCheck   = 0x10
	InitiatorBitCheck = 0x08
)

Flags

View Source
const (
	PKCS7WrappedX509Certificate = 1
	PGPCertificate              = 2
	DNSSignedKey                = 3
	X509CertificateSignature    = 4
	KerberosToken               = 6
	CertificateRevocationList   = 7
	AuthorityRevocationList     = 8
	SPKICertificate             = 9
	X509CertificateAttribute    = 10
	HashAndURLOfX509Certificate = 12
	HashAndURLOfX509Bundle      = 13
)

Certificate encoding

View Source
const (
	ID_IPV4_ADDR   = 1
	ID_FQDN        = 2
	ID_RFC822_ADDR = 3
	ID_IPV6_ADDR   = 5
	ID_DER_ASN1_DN = 9
	ID_DER_ASN1_GN = 10
	ID_KEY_ID      = 11
)

ID Types

View Source
const (
	RSADigitalSignature = iota + 1
	SharedKeyMesageIntegrityCode
	DSSDigitalSignature
)

Authentication Methods

View Source
const (
	CFG_REQUEST = 1
	CFG_REPLY   = 2
	CFG_SET     = 3
	CFG_ACK     = 4
)

Configuration types

View Source
const (
	INTERNAL_IP4_ADDRESS = 1
	INTERNAL_IP4_NETMASK = 2
	INTERNAL_IP4_DNS     = 3
	INTERNAL_IP4_NBNS    = 4
	INTERNAL_IP4_DHCP    = 6
	APPLICATION_VERSION  = 7
	INTERNAL_IP6_ADDRESS = 8
	INTERNAL_IP6_DNS     = 10
	INTERNAL_IP6_DHCP    = 12
	INTERNAL_IP4_SUBNET  = 13
	SUPPORTED_ATTRIBUTES = 14
	INTERNAL_IP6_SUBNET  = 15
)

Configuration attribute types

View Source
const (
	IPProtocolAll  = 0
	IPProtocolICMP = 1
	IPProtocolTCP  = 6
	IPProtocolUDP  = 17
	IPProtocolGRE  = 47
)

IP protocols ID, used in individual traffic selector

View Source
const (
	EAP5GType5GStart = 1
	EAP5GType5GNAS   = 2
	EAP5GType5GStop  = 4
)

Used in EAP-5G for message ID

View Source
const (
	ANParametersTypeGUAMI              = 1
	ANParametersTypeSelectedPLMNID     = 2
	ANParametersTypeRequestedNSSAI     = 3
	ANParametersTypeEstablishmentCause = 4
)

Used in AN-Parameter field for IE types

View Source
const (
	ANParametersLenGUAMI    = 6
	ANParametersLenPLMNID   = 3
	ANParametersLenEstCause = 1
)

Used for checking if AN-Parameter length field is legal

View Source
const (
	EstablishmentCauseEmergency          = 0
	EstablishmentCauseHighPriorityAccess = 1
	EstablishmentCauseMO_Signalling      = 3
	EstablishmentCauseMO_Data            = 4
	EstablishmentCauseMPS_PriorityAccess = 8
	EstablishmentCauseMCS_PriorityAccess = 9
)

Used in IE Establishment Cause field for cause types

View Source
const (
	Vendor3GPPNotifyType5G_QOS_INFO     uint16 = 55501
	Vendor3GPPNotifyTypeNAS_IP4_ADDRESS uint16 = 55502
	Vendor3GPPNotifyTypeUP_IP4_ADDRESS  uint16 = 55504
	Vendor3GPPNotifyTypeNAS_TCP_PORT    uint16 = 55506
)

3GPP specified IKE Notify 3GPP specified IKE Notify Message Types

View Source
const (
	NotifyType5G_QOS_INFOBitDSCPICheck uint8 = 1
	NotifyType5G_QOS_INFOBitDCSICheck  uint8 = 1 << 1
)

Used in NotifyType5G_QOS_INFO

View Source
const (
	AttributeTypeKeyLength = 14
)

used for SecurityAssociation-Proposal-Trandform AttributeType

View Source
const EAP5GSpareValue = 0

Spare

View Source
const VendorID3GPP = 10415

Types for EAP-5G Used in IKE EAP expanded for vendor ID

View Source
const VendorTypeEAP5G = 3

Used in IKE EAP expanded for vendor data

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	AuthenticationMethod uint8
	AuthenticationData   []byte
}

func (*Authentication) Type

func (authentication *Authentication) Type() IKEPayloadType

type Certificate

type Certificate struct {
	CertificateEncoding uint8
	CertificateData     []byte
}

func (*Certificate) Type

func (certificate *Certificate) Type() IKEPayloadType

type CertificateRequest

type CertificateRequest struct {
	CertificateEncoding    uint8
	CertificationAuthority []byte
}

func (*CertificateRequest) Type

func (certificateRequest *CertificateRequest) Type() IKEPayloadType

type Configuration

type Configuration struct {
	ConfigurationType      uint8
	ConfigurationAttribute ConfigurationAttributeContainer
}

func (*Configuration) Type

func (configuration *Configuration) Type() IKEPayloadType

type ConfigurationAttributeContainer

type ConfigurationAttributeContainer []*IndividualConfigurationAttribute

func (*ConfigurationAttributeContainer) BuildConfigurationAttribute

func (container *ConfigurationAttributeContainer) BuildConfigurationAttribute(
	attributeType uint16,
	attributeValue []byte,
)

func (*ConfigurationAttributeContainer) Reset

func (container *ConfigurationAttributeContainer) Reset()

type Delete

type Delete struct {
	ProtocolID  uint8
	SPISize     uint8
	NumberOfSPI uint16
	SPIs        []byte
}

func (*Delete) Type

func (del *Delete) Type() IKEPayloadType

type EAP

type EAP struct {
	Code        uint8
	Identifier  uint8
	EAPTypeData EAPTypeDataContainer
}

func (*EAP) Type

func (eap *EAP) Type() IKEPayloadType

type EAPExpanded

type EAPExpanded struct {
	VendorID   uint32
	VendorType uint32
	VendorData []byte
}

func (*EAPExpanded) Type

func (eapExpanded *EAPExpanded) Type() EAPType

type EAPIdentity

type EAPIdentity struct {
	IdentityData []byte
}

func (*EAPIdentity) Type

func (eapIdentity *EAPIdentity) Type() EAPType

type EAPNak

type EAPNak struct {
	NakData []byte
}

func (*EAPNak) Type

func (eapNak *EAPNak) Type() EAPType

type EAPNotification

type EAPNotification struct {
	NotificationData []byte
}

func (*EAPNotification) Type

func (eapNotification *EAPNotification) Type() EAPType

type EAPType

type EAPType uint8

EAP types

type EAPTypeDataContainer

type EAPTypeDataContainer []EAPTypeFormat

func (*EAPTypeDataContainer) BuildEAPExpanded

func (container *EAPTypeDataContainer) BuildEAPExpanded(vendorID uint32, vendorType uint32, vendorData []byte)

type EAPTypeFormat

type EAPTypeFormat interface {
	// Type specifies EAP types
	Type() EAPType
	// contains filtered or unexported methods
}

type Encrypted

type Encrypted struct {
	NextPayload   uint8
	EncryptedData []byte
}

func (*Encrypted) Type

func (encrypted *Encrypted) Type() IKEPayloadType

type IKEMessage

type IKEMessage struct {
	InitiatorSPI uint64
	ResponderSPI uint64
	Version      uint8
	ExchangeType uint8
	Flags        uint8
	MessageID    uint32
	Payloads     IKEPayloadContainer
}

func (*IKEMessage) BuildIKEHeader

func (ikeMessage *IKEMessage) BuildIKEHeader(
	initiatorSPI uint64,
	responsorSPI uint64,
	exchangeType uint8,
	flags uint8,
	messageID uint32,
)

func (*IKEMessage) Decode

func (ikeMessage *IKEMessage) Decode(rawData []byte) error

func (*IKEMessage) Encode

func (ikeMessage *IKEMessage) Encode() ([]byte, error)

type IKEPayload

type IKEPayload interface {
	// Type specifies the IKE payload types
	Type() IKEPayloadType
	// contains filtered or unexported methods
}

type IKEPayloadContainer

type IKEPayloadContainer []IKEPayload

func (*IKEPayloadContainer) BUildKeyExchange

func (container *IKEPayloadContainer) BUildKeyExchange(diffiehellmanGroup uint16, keyExchangeData []byte)

func (*IKEPayloadContainer) BuildAuthentication

func (container *IKEPayloadContainer) BuildAuthentication(authenticationMethod uint8, authenticationData []byte)

func (*IKEPayloadContainer) BuildCertificate

func (container *IKEPayloadContainer) BuildCertificate(certificateEncode uint8, certificateData []byte)

func (*IKEPayloadContainer) BuildConfiguration

func (container *IKEPayloadContainer) BuildConfiguration(configurationType uint8) *Configuration

func (*IKEPayloadContainer) BuildDeletePayload

func (container *IKEPayloadContainer) BuildDeletePayload(
	protocolID uint8, SPISize uint8, numberOfSPI uint16, SPIs []byte,
)

func (*IKEPayloadContainer) BuildEAP

func (container *IKEPayloadContainer) BuildEAP(code uint8, identifier uint8) *EAP

func (*IKEPayloadContainer) BuildEAP5GNAS

func (container *IKEPayloadContainer) BuildEAP5GNAS(identifier uint8, nasPDU []byte)

func (*IKEPayloadContainer) BuildEAP5GStart

func (container *IKEPayloadContainer) BuildEAP5GStart(identifier uint8)

func (*IKEPayloadContainer) BuildEAPSuccess

func (container *IKEPayloadContainer) BuildEAPSuccess(identifier uint8)

func (*IKEPayloadContainer) BuildEAPfailure

func (container *IKEPayloadContainer) BuildEAPfailure(identifier uint8)

func (*IKEPayloadContainer) BuildEncrypted

func (container *IKEPayloadContainer) BuildEncrypted(nextPayload IKEPayloadType, encryptedData []byte) *Encrypted

func (*IKEPayloadContainer) BuildIdentificationInitiator

func (container *IKEPayloadContainer) BuildIdentificationInitiator(idType uint8, idData []byte)

func (*IKEPayloadContainer) BuildIdentificationResponder

func (container *IKEPayloadContainer) BuildIdentificationResponder(idType uint8, idData []byte)

func (*IKEPayloadContainer) BuildNonce

func (container *IKEPayloadContainer) BuildNonce(nonceData []byte)

func (*IKEPayloadContainer) BuildNotification

func (container *IKEPayloadContainer) BuildNotification(
	protocolID uint8,
	notifyMessageType uint16,
	spi []byte,
	notificationData []byte,
)

func (*IKEPayloadContainer) BuildNotify5G_QOS_INFO

func (container *IKEPayloadContainer) BuildNotify5G_QOS_INFO(
	pduSessionID uint8,
	qfiList []uint8,
	isDefault bool,
	isDSCPSpecified bool,
	DSCP uint8,
)

func (*IKEPayloadContainer) BuildNotifyNAS_IP4_ADDRESS

func (container *IKEPayloadContainer) BuildNotifyNAS_IP4_ADDRESS(nasIPAddr string)

func (*IKEPayloadContainer) BuildNotifyNAS_TCP_PORT

func (container *IKEPayloadContainer) BuildNotifyNAS_TCP_PORT(port uint16)

func (*IKEPayloadContainer) BuildNotifyUP_IP4_ADDRESS

func (container *IKEPayloadContainer) BuildNotifyUP_IP4_ADDRESS(upIPAddr string)

func (*IKEPayloadContainer) BuildSecurityAssociation

func (container *IKEPayloadContainer) BuildSecurityAssociation() *SecurityAssociation

func (*IKEPayloadContainer) BuildTrafficSelectorInitiator

func (container *IKEPayloadContainer) BuildTrafficSelectorInitiator() *TrafficSelectorInitiator

func (*IKEPayloadContainer) BuildTrafficSelectorResponder

func (container *IKEPayloadContainer) BuildTrafficSelectorResponder() *TrafficSelectorResponder

func (*IKEPayloadContainer) Decode

func (container *IKEPayloadContainer) Decode(nextPayload uint8, rawData []byte) error

func (*IKEPayloadContainer) Encode

func (container *IKEPayloadContainer) Encode() ([]byte, error)

func (*IKEPayloadContainer) Reset

func (container *IKEPayloadContainer) Reset()

type IKEPayloadType

type IKEPayloadType uint8

IKE types

type IdentificationInitiator

type IdentificationInitiator struct {
	IDType uint8
	IDData []byte
}

func (*IdentificationInitiator) Type

func (identification *IdentificationInitiator) Type() IKEPayloadType

type IdentificationResponder

type IdentificationResponder struct {
	IDType uint8
	IDData []byte
}

func (*IdentificationResponder) Type

func (identification *IdentificationResponder) Type() IKEPayloadType

type IndividualConfigurationAttribute

type IndividualConfigurationAttribute struct {
	Type  uint16
	Value []byte
}

type IndividualTrafficSelector

type IndividualTrafficSelector struct {
	TSType       uint8
	IPProtocolID uint8
	StartPort    uint16
	EndPort      uint16
	StartAddress []byte
	EndAddress   []byte
}

type IndividualTrafficSelectorContainer

type IndividualTrafficSelectorContainer []*IndividualTrafficSelector

func (*IndividualTrafficSelectorContainer) BuildIndividualTrafficSelector

func (container *IndividualTrafficSelectorContainer) BuildIndividualTrafficSelector(
	tsType uint8,
	ipProtocolID uint8,
	startPort uint16,
	endPort uint16,
	startAddr []byte,
	endAddr []byte,
)

func (*IndividualTrafficSelectorContainer) Reset

func (container *IndividualTrafficSelectorContainer) Reset()

type KeyExchange

type KeyExchange struct {
	DiffieHellmanGroup uint16
	KeyExchangeData    []byte
}

func (*KeyExchange) Type

func (keyExchange *KeyExchange) Type() IKEPayloadType

type Nonce

type Nonce struct {
	NonceData []byte
}

func (*Nonce) Type

func (nonce *Nonce) Type() IKEPayloadType

type Notification

type Notification struct {
	ProtocolID        uint8
	NotifyMessageType uint16
	SPI               []byte
	NotificationData  []byte
}

func (*Notification) Type

func (notification *Notification) Type() IKEPayloadType

type Proposal

type Proposal struct {
	ProposalNumber          uint8
	ProtocolID              uint8
	SPI                     []byte
	EncryptionAlgorithm     TransformContainer
	PseudorandomFunction    TransformContainer
	IntegrityAlgorithm      TransformContainer
	DiffieHellmanGroup      TransformContainer
	ExtendedSequenceNumbers TransformContainer
}

type ProposalContainer

type ProposalContainer []*Proposal

func (*ProposalContainer) BuildProposal

func (container *ProposalContainer) BuildProposal(proposalNumber uint8, protocolID uint8, spi []byte) *Proposal

func (*ProposalContainer) Reset

func (container *ProposalContainer) Reset()

type SecurityAssociation

type SecurityAssociation struct {
	Proposals ProposalContainer
}

func (*SecurityAssociation) Type

func (securityAssociation *SecurityAssociation) Type() IKEPayloadType

type TrafficSelectorInitiator

type TrafficSelectorInitiator struct {
	TrafficSelectors IndividualTrafficSelectorContainer
}

func (*TrafficSelectorInitiator) Type

func (trafficSelector *TrafficSelectorInitiator) Type() IKEPayloadType

type TrafficSelectorResponder

type TrafficSelectorResponder struct {
	TrafficSelectors IndividualTrafficSelectorContainer
}

func (*TrafficSelectorResponder) Type

func (trafficSelector *TrafficSelectorResponder) Type() IKEPayloadType

type Transform

type Transform struct {
	TransformType                uint8
	TransformID                  uint16
	AttributePresent             bool
	AttributeFormat              uint8
	AttributeType                uint16
	AttributeValue               uint16
	VariableLengthAttributeValue []byte
}

type TransformContainer

type TransformContainer []*Transform

func (*TransformContainer) BuildTransform

func (container *TransformContainer) BuildTransform(
	transformType uint8,
	transformID uint16,
	attributeType *uint16,
	attributeValue *uint16,
	variableLengthAttributeValue []byte,
)

func (*TransformContainer) Reset

func (container *TransformContainer) Reset()

type VendorID

type VendorID struct {
	VendorIDData []byte
}

func (*VendorID) Type

func (vendorID *VendorID) Type() IKEPayloadType

Jump to

Keyboard shortcuts

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