ike_message

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

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 (
	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

func AppendTransformToProposal

func AppendTransformToProposal(proposal *Proposal, transform *Transform) bool

func Encode

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

func EncodePayload

func EncodePayload(ikePayload []IKEPayloadType) ([]byte, error)

Types

type Authentication

type Authentication struct {
	AuthenticationMethod uint8
	AuthenticationData   []byte
}

func BuildAuthentication

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

func (*Authentication) Type

func (authentication *Authentication) Type() IKEType

type Certificate

type Certificate struct {
	CertificateEncoding uint8
	CertificateData     []byte
}

func BuildCertificate

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

func (*Certificate) Type

func (certificate *Certificate) Type() IKEType

type CertificateRequest

type CertificateRequest struct {
	CertificateEncoding    uint8
	CertificationAuthority []byte
}

func (*CertificateRequest) Type

func (certificateRequest *CertificateRequest) Type() IKEType

type Configuration

type Configuration struct {
	ConfigurationType      uint8
	ConfigurationAttribute []*IndividualConfigurationAttribute
}

func BuildConfiguration

func BuildConfiguration(configurationType uint8, attributes []*IndividualConfigurationAttribute) *Configuration

func (*Configuration) Type

func (configuration *Configuration) Type() IKEType

type Delete

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

func (*Delete) Type

func (delete *Delete) Type() IKEType

type EAP

type EAP struct {
	Code        uint8
	Identifier  uint8
	EAPTypeData []EAPTypeFormat
}

func BuildEAP

func BuildEAP(code uint8, identifier uint8, eapTypeData EAPTypeFormat) *EAP

func BuildEAP5GNAS

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

func BuildEAP5GStart

func BuildEAP5GStart(identifier uint8) *EAP

func BuildEAPSuccess

func BuildEAPSuccess(identifier uint8) *EAP

func BuildEAPfailure

func BuildEAPfailure(identifier uint8) *EAP

func (*EAP) Type

func (eap *EAP) Type() IKEType

type EAPExpanded

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

func BuildEAPExpanded

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

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 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 BuildEncrypted

func BuildEncrypted(nextPayload IKEType, encryptedData []byte) *Encrypted

func (*Encrypted) Type

func (encrypted *Encrypted) Type() IKEType

type IKEMessage

type IKEMessage struct {
	InitiatorSPI uint64
	ResponderSPI uint64
	Version      uint8
	ExchangeType uint8
	Flags        uint8
	MessageID    uint32
	IKEPayload   []IKEPayloadType
}

func BuildIKEHeader

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

func Decode

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

type IKEPayloadType

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

func DecodePayload

func DecodePayload(nextPayload uint8, rawData []byte) ([]IKEPayloadType, error)

type IKEType

type IKEType uint8

IKE types

type IdentificationInitiator

type IdentificationInitiator struct {
	IDType uint8
	IDData []byte
}

func BuildIdentificationInitiator

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

func (*IdentificationInitiator) Type

func (identification *IdentificationInitiator) Type() IKEType

type IdentificationResponder

type IdentificationResponder struct {
	IDType uint8
	IDData []byte
}

func BuildIdentificationResponder

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

func (*IdentificationResponder) Type

func (identification *IdentificationResponder) Type() IKEType

type IndividualConfigurationAttribute

type IndividualConfigurationAttribute struct {
	Type  uint16
	Value []byte
}

func BuildConfigurationAttribute

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

type IndividualTrafficSelector

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

func BuildIndividualTrafficSelector

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

type KeyExchange

type KeyExchange struct {
	DiffieHellmanGroup uint16
	KeyExchangeData    []byte
}

func BUildKeyExchange

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

func (*KeyExchange) Type

func (keyExchange *KeyExchange) Type() IKEType

type Nonce

type Nonce struct {
	NonceData []byte
}

func BuildNonce

func BuildNonce(nonceData []byte) *Nonce

func (*Nonce) Type

func (nonce *Nonce) Type() IKEType

type Notification

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

func BuildNotification

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

func BuildNotify5G_QOS_INFO

func BuildNotify5G_QOS_INFO(pduSessionID uint8, qfiList []uint8, isDefault bool) *Notification

func BuildNotifyNAS_IP4_ADDRESS

func BuildNotifyNAS_IP4_ADDRESS(nasIPAddr string) *Notification

func BuildNotifyNAS_TCP_PORT

func BuildNotifyNAS_TCP_PORT(port uint16) *Notification

func BuildNotifyUP_IP4_ADDRESS

func BuildNotifyUP_IP4_ADDRESS(upIPAddr string) *Notification

func (*Notification) Type

func (notification *Notification) Type() IKEType

type Proposal

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

func BuildProposal

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

type SecurityAssociation

type SecurityAssociation struct {
	Proposals []*Proposal
}

func BuildSecurityAssociation

func BuildSecurityAssociation(proposals []*Proposal) *SecurityAssociation

func (*SecurityAssociation) Type

func (securityAssociation *SecurityAssociation) Type() IKEType

type TrafficSelectorInitiator

type TrafficSelectorInitiator struct {
	TrafficSelectors []*IndividualTrafficSelector
}

func BuildTrafficSelectorInitiator

func BuildTrafficSelectorInitiator(trafficSelectors []*IndividualTrafficSelector) *TrafficSelectorInitiator

func (*TrafficSelectorInitiator) Type

func (trafficSelector *TrafficSelectorInitiator) Type() IKEType

type TrafficSelectorResponder

type TrafficSelectorResponder struct {
	TrafficSelectors []*IndividualTrafficSelector
}

func BuildTrafficSelectorResponder

func BuildTrafficSelectorResponder(trafficSelectors []*IndividualTrafficSelector) *TrafficSelectorResponder

func (*TrafficSelectorResponder) Type

func (trafficSelector *TrafficSelectorResponder) Type() IKEType

type Transform

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

func BuildTransform

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

type VendorID

type VendorID struct {
	VendorIDData []byte
}

func (*VendorID) Type

func (vendorID *VendorID) Type() IKEType

Jump to

Keyboard shortcuts

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