Documentation
¶
Index ¶
- Constants
- Variables
- func DeriveIKESAKeyMaterial(hash crypto.Hash, skeyseed, nonceI, nonceR []byte, spiI, spiR uint64, ...) ([]byte, error)
- func FirstNotifyError(payloads []Payload) error
- func IntegrityChecksum(profile KeyMaterialProfile, key, data []byte) ([]byte, error)
- func InvalidKEPayloadAlternativeGroupFromError(err error) (uint16, bool, error)
- func MarshalPayloads(payloads []Payload) (first uint8, data []byte, err error)
- func NATDetectionHash(spiI, spiR uint64, ip net.IP, port uint16) ([]byte, error)
- func NotifyErrorFor(n Notify) error
- func NotifyTypeName(notifyType uint16) string
- func PRF(hash crypto.Hash, key, data []byte) ([]byte, error)
- func PRFHashForTransform(id uint16) (crypto.Hash, error)
- func PRFPlus(hash crypto.Hash, key, seed []byte, length int) ([]byte, error)
- func ParseInformationalRequest(raw []byte, init InitResult, keys IKEKeys, messageID uint32) (Message, []Payload, error)
- func ParseInformationalRequestContent(raw []byte, init InitResult, keys IKEKeys, messageID uint32) (Message, InformationalContent, error)
- func ParseInformationalRequestContentFrom(raw []byte, init InitResult, keys IKEKeys, messageID uint32, ...) (Message, InformationalContent, error)
- func ParseInformationalRequestFrom(raw []byte, init InitResult, keys IKEKeys, messageID uint32, ...) (Message, []Payload, error)
- func ParseInformationalResponse(raw []byte, init InitResult, keys IKEKeys, messageID uint32) (Message, []Payload, error)
- func ParseInformationalResponseContent(raw []byte, init InitResult, keys IKEKeys, messageID uint32) (Message, InformationalContent, error)
- func ParseInformationalResponseContentFrom(raw []byte, init InitResult, keys IKEKeys, messageID uint32, ...) (Message, InformationalContent, error)
- func ParseInformationalResponseFrom(raw []byte, init InitResult, keys IKEKeys, messageID uint32, ...) (Message, []Payload, error)
- func RandomIV(random io.Reader, profile KeyMaterialProfile) ([]byte, error)
- func SKEYSEED(hash crypto.Hash, nonceI, nonceR, sharedSecret []byte) ([]byte, error)
- func UnprotectMessage(raw []byte, keys IKEKeys, fromInitiator bool) (Message, []Payload, error)
- func ValidateSelectedSA(offered, selected SecurityAssociation) error
- func ValidateTrafficSelectorNarrowing(offered, selected TrafficSelectors) error
- type AKAChallengeConfig
- type AKAChallengeResult
- type AuthConfig
- type AuthResult
- type ChildSADeleteMatch
- type ChildSADeleteOutcome
- type ChildSADeleteSummary
- type ChildSAKeys
- type ChildSARekeyConfig
- type ChildSARekeyPlan
- type ChildSAResult
- type Configuration
- type ConfigurationAttribute
- type CreateChildSAConfig
- type CreateChildSAResult
- type Delete
- type EAPIdentityExchange
- type ESPKeyProfile
- type ESPKeys
- type EncryptedFragment
- type FullAuthConfig
- type FullAuthResult
- type Header
- type IKEKeys
- type Identity
- type InformationalConfig
- type InformationalContent
- type InformationalHandling
- type InformationalRecoveryAction
- type InformationalRecoveryPlan
- type InformationalResponsePlan
- type InformationalResult
- type InitConfig
- type InitResult
- type InitTransport
- type InvalidSelectorReport
- type KeyExchange
- type KeyMaterialProfile
- type Message
- func BuildInformationalRequest(init InitResult, keys IKEKeys, messageID uint32, inner []Payload, iv []byte) (Message, []byte, error)
- func BuildInformationalRequestFrom(init InitResult, keys IKEKeys, messageID uint32, fromInitiator bool, ...) (Message, []byte, error)
- func BuildInformationalResponse(init InitResult, keys IKEKeys, messageID uint32, inner []Payload, iv []byte) (Message, []byte, error)
- func BuildInformationalResponseFrom(init InitResult, keys IKEKeys, messageID uint32, fromInitiator bool, ...) (Message, []byte, error)
- func ParseMessage(data []byte) (Message, error)
- func ProtectMessage(header Header, keys IKEKeys, fromInitiator bool, inner []Payload, iv []byte) (Message, []byte, error)
- type Notify
- type NotifyAction
- type NotifyActionKind
- type NotifyError
- type Payload
- func AdditionalIPAddressNotify(ip net.IP) (Payload, error)
- func BuildCreateChildSAPayloads(cfg CreateChildSAConfig) ([]Payload, []byte, []byte, error)
- func BuildIKEAuthInitialPayloads(cfg AuthConfig) ([]Payload, error)
- func ChildSADeletePayload(child ChildSAResult) (Payload, error)
- func ConfigurationPayload(c Configuration) (Payload, error)
- func Cookie2Notify(cookie []byte) (Payload, error)
- func CookieNotify(cookie []byte) (Payload, error)
- func DeletePayload(d Delete) (Payload, error)
- func EAPPayload(packet []byte) Payload
- func ESPDeletePayload(spis ...[]byte) (Payload, error)
- func EncryptedFragmentPayload(nextPayload uint8, fragment EncryptedFragment) (Payload, error)
- func IKEDeletePayload() Payload
- func IdentityPayload(payloadType uint8, id Identity) (Payload, error)
- func KeyExchangePayload(group uint16, keyData []byte) Payload
- func MOBIKESupportedNotify() Payload
- func NATDetectionNotify(notifyType uint16, spiI, spiR uint64, ip net.IP, port uint16) (Payload, error)
- func NoAdditionalAddressesNotify() Payload
- func NoncePayload(nonce []byte) Payload
- func NotifyPayload(n Notify) (Payload, error)
- func NotifyWithZeroSPI(notifyType uint16, data []byte) Payload
- func ParsePayloads(first uint8, data []byte) ([]Payload, error)
- func SecurityAssociationPayload(sa SecurityAssociation) (Payload, error)
- func TeardownDeletePayloads(child ChildSAResult, includeIKESA bool) ([]Payload, error)
- func TrafficSelectorsPayload(payloadType uint8, ts TrafficSelectors) (Payload, error)
- func UpdateSAAddressesNotify() Payload
- type Proposal
- type SecurityAssociation
- type TrafficSelector
- type TrafficSelectors
- type Transform
- type TransformAttribute
- type UDPTransport
Constants ¶
View Source
const ( DefaultNonceLength = 32 DefaultIKEKeyMaterialLength = 192 )
View Source
const ( ProtocolIKE uint8 = 1 ProtocolAH uint8 = 2 ProtocolESP uint8 = 3 )
View Source
const ( NotifyUnsupportedCriticalPayload uint16 = 1 NotifyInvalidIKESPI uint16 = 4 NotifyInvalidMajorVersion uint16 = 5 NotifyInvalidSyntax uint16 = 7 NotifyInvalidMessageID uint16 = 9 NotifyInvalidSPI uint16 = 11 NotifyNoProposalChosen uint16 = 14 NotifyInvalidKEPayload uint16 = 17 NotifyAuthenticationFailed uint16 = 24 NotifySinglePairRequired uint16 = 34 NotifyNoAdditionalSAs uint16 = 35 NotifyInternalAddressFailure uint16 = 36 NotifyFailedCPRequired uint16 = 37 NotifyTSUnacceptable uint16 = 38 NotifyInvalidSelectors uint16 = 39 NotifyUnacceptableAddresses uint16 = 40 NotifyUnexpectedNATDetected uint16 = 41 NotifyNATDetectionSourceIP uint16 = 16388 NotifyNATDetectionDestinationIP uint16 = 16389 NotifyCookie uint16 = 16390 NotifyRekeySA uint16 = 16393 NotifyMOBIKESupported uint16 = 16396 NotifyAdditionalIPv4Address uint16 = 16397 NotifyAdditionalIPv6Address uint16 = 16398 NotifyNoAdditionalAddresses uint16 = 16399 NotifyUpdateSAAddresses uint16 = 16400 NotifyCookie2 uint16 = 16401 NotifyNoNATsAllowed uint16 = 16402 )
View Source
const ( MaxIKECookieLength = 64 DHGroup2048BitMODP uint16 = 14 DHGroup256BitECP uint16 = 19 DHGroup384BitECP uint16 = 20 DHGroup521BitECP uint16 = 21 DHGroupCurve25519 uint16 = 31 )
View Source
const ( TransformENCR uint8 = 1 TransformPRF uint8 = 2 TransformINTEG uint8 = 3 TransformDHRGroup uint8 = 4 TransformESN uint8 = 5 )
View Source
const ( ENCR_AES_CBC uint16 = 12 ENCR_AES_GCM_16 uint16 = 20 PRF_HMAC_SHA1 uint16 = 2 PRF_HMAC_SHA2_256 uint16 = 5 PRF_HMAC_SHA2_384 uint16 = 6 PRF_HMAC_SHA2_512 uint16 = 7 INTEG_HMAC_SHA1_96 uint16 = 2 INTEG_AES_XCBC_96 uint16 = 5 INTEG_HMAC_SHA2_256_128 uint16 = 12 INTEG_HMAC_SHA2_384_192 uint16 = 13 INTEG_HMAC_SHA2_512_256 uint16 = 14 ESNNo uint16 = 0 ESNYes uint16 = 1 )
View Source
const ( IDIPv4Addr uint8 = 1 IDFQDN uint8 = 2 IDRFC822Addr uint8 = 3 IDIPv6Addr uint8 = 5 IDKeyID uint8 = 11 )
View Source
const ( CFGRequest uint8 = 1 CFGReply uint8 = 2 CFGSet uint8 = 3 CFGAck uint8 = 4 )
View Source
const ( ConfigInternalIPv4Address uint16 = 1 ConfigInternalIPv4DNS uint16 = 3 ConfigInternalAddressExpiry uint16 = 5 ConfigInternalIPv6Address uint16 = 8 ConfigInternalIPv6DNS uint16 = 10 ConfigInternalIPv4Subnet uint16 = 13 ConfigSupportedAttributes uint16 = 14 ConfigInternalIPv6Subnet uint16 = 15 )
View Source
const ( TSIPv4AddressRange uint8 = 7 TSIPv6AddressRange uint8 = 8 )
View Source
const ( PayloadNoNext uint8 = 0 PayloadSA uint8 = 33 PayloadKE uint8 = 34 PayloadIDi uint8 = 35 PayloadIDr uint8 = 36 PayloadCERT uint8 = 37 PayloadCERTREQ uint8 = 38 PayloadAUTH uint8 = 39 PayloadNonce uint8 = 40 PayloadNotify uint8 = 41 PayloadDelete uint8 = 42 PayloadVendorID uint8 = 43 PayloadTSi uint8 = 44 PayloadTSr uint8 = 45 PayloadSK uint8 = 46 PayloadCP uint8 = 47 PayloadEAP uint8 = 48 PayloadSKF uint8 = 53 )
View Source
const ( ExchangeIKE_SA_INIT uint8 = 34 ExchangeIKE_AUTH uint8 = 35 ExchangeCREATE_CHILD_SA uint8 = 36 ExchangeINFORMATIONAL uint8 = 37 )
View Source
const ( FlagInitiator uint8 = 0x08 FlagVersion uint8 = 0x10 FlagResponse uint8 = 0x20 )
View Source
const (
AttributeKeyLength uint16 = 14
)
View Source
const HeaderLength = 28
Variables ¶
View Source
var ( ErrInvalidAuthConfig = errors.New("invalid ikev2 auth config") ErrInvalidAuthResponse = errors.New("invalid ikev2 auth response") )
View Source
var ( ErrInvalidInitConfig = errors.New("invalid ikev2 init config") ErrInvalidInitResponse = errors.New("invalid ikev2 init response") )
View Source
var ( ErrInvalidNotify = errors.New("invalid ikev2 notify payload") ErrIKEv2NotifyError = errors.New("ikev2 notify error") ErrNotifyUnsupportedCriticalPayload = errors.New("ikev2 unsupported critical payload notify") ErrNotifyInvalidIKESPI = errors.New("ikev2 invalid ike spi notify") ErrNotifyInvalidMajorVersion = errors.New("ikev2 invalid major version notify") ErrNotifyInvalidSyntax = errors.New("ikev2 invalid syntax notify") ErrNotifyInvalidMessageID = errors.New("ikev2 invalid message id notify") ErrNotifyInvalidSPI = errors.New("ikev2 invalid spi notify") ErrNotifyNoProposalChosen = errors.New("ikev2 no proposal chosen notify") ErrNotifyInvalidKEPayload = errors.New("ikev2 invalid ke payload notify") ErrNotifyAuthenticationFailed = errors.New("ikev2 authentication failed notify") ErrNotifySinglePairRequired = errors.New("ikev2 single pair required notify") ErrNotifyNoAdditionalSAs = errors.New("ikev2 no additional sas notify") ErrNotifyInternalAddressFailure = errors.New("ikev2 internal address failure notify") ErrNotifyFailedCPRequired = errors.New("ikev2 failed cp required notify") ErrNotifyTSUnacceptable = errors.New("ikev2 ts unacceptable notify") ErrNotifyInvalidSelectors = errors.New("ikev2 invalid selectors notify") ErrNotifyUnacceptableAddresses = errors.New("ikev2 unacceptable addresses notify") ErrNotifyUnexpectedNATDetected = errors.New("ikev2 unexpected nat detected notify") ErrInvalidDelete = errors.New("invalid ikev2 delete payload") ErrInvalidAddress = errors.New("invalid ikev2 address") )
View Source
var ( ErrInvalidSA = errors.New("invalid ikev2 sa payload") ErrUnsupportedSASelection = errors.New("unsupported ikev2 selected sa") )
View Source
var ( ErrInvalidIdentity = errors.New("invalid ikev2 identity payload") ErrInvalidConfiguration = errors.New("invalid ikev2 configuration payload") ErrInvalidTrafficSelector = errors.New("invalid ikev2 traffic selector payload") )
View Source
var ( ErrShortHeader = errors.New("ikev2 header too short") ErrShortPayload = errors.New("ikev2 payload too short") ErrInvalidLength = errors.New("ikev2 invalid length") )
View Source
var ErrInvalidChildSA = errors.New("invalid ikev2 child sa")
View Source
var ErrInvalidCreateChild = errors.New("invalid ikev2 create child sa exchange")
View Source
var ErrInvalidEncryptedFragment = errors.New("invalid ikev2 encrypted fragment payload")
View Source
var ErrInvalidInformational = errors.New("invalid ikev2 informational exchange")
View Source
var ErrInvalidSKPayload = errors.New("invalid ikev2 sk payload")
View Source
var ErrUnsupportedPRF = errors.New("unsupported ikev2 prf")
View Source
var ErrUnsupportedTransform = errors.New("unsupported ikev2 transform")
Functions ¶
func DeriveIKESAKeyMaterial ¶
func FirstNotifyError ¶
func IntegrityChecksum ¶
func IntegrityChecksum(profile KeyMaterialProfile, key, data []byte) ([]byte, error)
func InvalidKEPayloadAlternativeGroupFromError ¶
InvalidKEPayloadAlternativeGroupFromError extracts an INVALID_KE_PAYLOAD suggested DH group from a wrapped NotifyError.
func MarshalPayloads ¶
func NATDetectionHash ¶
func NotifyErrorFor ¶
func NotifyTypeName ¶
func ParseInformationalRequestContent ¶
func ParseInformationalRequestContent(raw []byte, init InitResult, keys IKEKeys, messageID uint32) (Message, InformationalContent, error)
func ParseInformationalRequestContentFrom ¶
func ParseInformationalRequestContentFrom(raw []byte, init InitResult, keys IKEKeys, messageID uint32, fromInitiator bool) (Message, InformationalContent, error)
func ParseInformationalResponseContent ¶
func ParseInformationalResponseContent(raw []byte, init InitResult, keys IKEKeys, messageID uint32) (Message, InformationalContent, error)
func ParseInformationalResponseContentFrom ¶
func ParseInformationalResponseContentFrom(raw []byte, init InitResult, keys IKEKeys, messageID uint32, fromInitiator bool) (Message, InformationalContent, error)
func UnprotectMessage ¶
func ValidateSelectedSA ¶
func ValidateSelectedSA(offered, selected SecurityAssociation) error
func ValidateTrafficSelectorNarrowing ¶
func ValidateTrafficSelectorNarrowing(offered, selected TrafficSelectors) error
Types ¶
type AKAChallengeConfig ¶
type AKAChallengeConfig struct {
Transport InitTransport
Init InitResult
Keys IKEKeys
SIM sim.AKAProvider
EAPKeys eapaka.Keys
Identity string
Request eapaka.Packet
IdentityTranscript [][]byte
ChildSPI []byte
TSi TrafficSelectors
TSr TrafficSelectors
MessageID uint32
Random io.Reader
IV []byte
EAPReauthIV []byte
EAPReauthCounter uint16
EAPReauthCounterOK bool
}
type AKAChallengeResult ¶
type AKAChallengeResult struct {
RequestBytes []byte
ResponseBytes []byte
ResponseInner []Payload
EAPResponse eapaka.Packet
EAPNext *eapaka.Packet
EAPKeys eapaka.Keys
EAPEncryptedAttributes []eapaka.Attribute
EAPNextPseudonym string
EAPNextReauthID string
EAPReauthenticated bool
EAPReauthCounter uint16
EAPReauthCounterTooSmall bool
EAPNotifications []eapaka.Packet
EAPClientError bool
ChildSA *ChildSAResult
SyncFailure bool
AuthFailure bool
KDFNegotiated bool
NextMessageID uint32
FollowupRequestBytes [][]byte
FollowupResponseBytes [][]byte
FinalResponseBytes []byte
FinalResponseInner []Payload
}
func RunIKE_AUTH_AKAChallenge ¶
func RunIKE_AUTH_AKAChallenge(ctx context.Context, cfg AKAChallengeConfig) (AKAChallengeResult, error)
type AuthConfig ¶
type AuthConfig struct {
Transport InitTransport
Init InitResult
Keys IKEKeys
InitiatorID Identity
EAPIdentity string
EAPPseudonym string
EAPReauthIdentity string
ChildSA SecurityAssociation
ChildSPI []byte
TSi TrafficSelectors
TSr TrafficSelectors
Configuration Configuration
Random io.Reader
InitialIV []byte
EAPIdentityIV []byte
InitialMessageID uint32
}
type AuthResult ¶
type AuthResult struct {
InitialRequestBytes []byte
InitialResponseBytes []byte
IdentityRequestBytes []byte
IdentityResponseBytes []byte
InitialResponseInner []Payload
IdentityResponseInner []Payload
EAPRequest *eapaka.Packet
EAPAfterIdentity *eapaka.Packet
EAPIdentityUsed string
IdentityTranscript [][]byte
NextMessageID uint32
}
func RunIKE_AUTH_EAPIdentity ¶
func RunIKE_AUTH_EAPIdentity(ctx context.Context, cfg AuthConfig) (AuthResult, error)
type ChildSADeleteMatch ¶
type ChildSADeleteOutcome ¶
type ChildSADeleteOutcome uint8
const ( ChildSADeleteNone ChildSADeleteOutcome = iota // ChildSADeleteCurrent means every AH/ESP delete SPI matches the tracked ESP child. ChildSADeleteCurrent // ChildSADeleteOther means AH/ESP delete payloads exist, but none match the tracked ESP child. ChildSADeleteOther // ChildSADeleteMixed means an INFORMATIONAL deletes both the tracked child and other AH/ESP SPIs. ChildSADeleteMixed )
type ChildSADeleteSummary ¶
type ChildSADeleteSummary struct {
Outcome ChildSADeleteOutcome
Deletes []ChildSADeleteMatch
CurrentSPIs [][]byte
OtherSPIs [][]byte
MatchesLocal bool
MatchesRemote bool
DeleteIKE bool
}
func ClassifyChildSADeletePayloads ¶
func ClassifyChildSADeletePayloads(payloads []Payload, child ChildSAResult) (ChildSADeleteSummary, error)
func ClassifyChildSADeletes ¶
func ClassifyChildSADeletes(content InformationalContent, child ChildSAResult) ChildSADeleteSummary
ClassifyChildSADeletes summarizes AH/ESP Delete payloads against a tracked ESP child SA.
type ChildSAKeys ¶
type ChildSAKeys struct {
Profile ESPKeyProfile
Outbound ESPKeys
Inbound ESPKeys
}
func DeriveChildSAKeys ¶
func DeriveChildSAKeys(init InitResult, selectedSA SecurityAssociation) (ChildSAKeys, error)
func DeriveChildSAKeysWithNonces ¶
func DeriveChildSAKeysWithNonces(prf crypto.Hash, skD, nonceI, nonceR []byte, selectedSA SecurityAssociation) (ChildSAKeys, error)
type ChildSARekeyConfig ¶
type ChildSARekeyConfig struct {
Transport InitTransport
Init InitResult
Keys IKEKeys
MessageID uint32
OldChildSA ChildSAResult
ChildSA SecurityAssociation
ChildSPI []byte
RekeySPI []byte
TSi TrafficSelectors
TSr TrafficSelectors
Nonce []byte
Random io.Reader
IV []byte
}
type ChildSARekeyPlan ¶
type ChildSARekeyPlan struct {
Config CreateChildSAConfig
OldLocalSPI []byte
OldRemoteSPI []byte
RekeySPI []byte
NewLocalSPI []byte
}
func NewChildSARekeyPlan ¶
func NewChildSARekeyPlan(cfg ChildSARekeyConfig) (ChildSARekeyPlan, error)
type ChildSAResult ¶
type ChildSAResult struct {
SelectedSA SecurityAssociation
TSi TrafficSelectors
TSr TrafficSelectors
Configuration *Configuration
LocalSPI []byte
RemoteSPI []byte
Keys ChildSAKeys
EAPSuccess bool
NextMessageID uint32
}
func ParseChildSAResult ¶
func ParseChildSAResult(init InitResult, inner []Payload, localSPI []byte) (ChildSAResult, error)
func ParseChildSAResultWithNonces ¶
func ParseChildSAResultWithNonces(init InitResult, inner []Payload, localSPI, nonceI, nonceR []byte) (ChildSAResult, error)
type Configuration ¶
type Configuration struct {
Type uint8
Attributes []ConfigurationAttribute
}
func ParseConfiguration ¶
func ParseConfiguration(data []byte) (Configuration, error)
func SWuConfigurationRequest ¶
func SWuConfigurationRequest() Configuration
func (Configuration) MarshalBinary ¶
func (c Configuration) MarshalBinary() ([]byte, error)
type ConfigurationAttribute ¶
type CreateChildSAConfig ¶
type CreateChildSAConfig struct {
Transport InitTransport
Init InitResult
Keys IKEKeys
MessageID uint32
ChildSA SecurityAssociation
ChildSPI []byte
TSi TrafficSelectors
TSr TrafficSelectors
Nonce []byte
RekeySPI []byte
Random io.Reader
IV []byte
}
type CreateChildSAResult ¶
type CreateChildSAResult struct {
RequestBytes []byte
ResponseBytes []byte
RequestNonce []byte
ResponseNonce []byte
ResponseInner []Payload
ChildSA ChildSAResult
NextMessageID uint32
Rekeyed bool
}
func RunCREATE_CHILD_SA ¶
func RunCREATE_CHILD_SA(ctx context.Context, cfg CreateChildSAConfig) (CreateChildSAResult, error)
func RunCREATE_CHILD_SARekey ¶
func RunCREATE_CHILD_SARekey(ctx context.Context, cfg ChildSARekeyConfig) (CreateChildSAResult, error)
type EAPIdentityExchange ¶
type ESPKeyProfile ¶
type ESPKeyProfile struct {
EncryptionID uint16
EncryptionKeyLength int
IntegrityID uint16
IntegrityKeyLength int
ESN bool
}
func ESPKeyProfileFromSA ¶
func ESPKeyProfileFromSA(sa SecurityAssociation) (ESPKeyProfile, error)
func (ESPKeyProfile) DirectionKeyLength ¶
func (p ESPKeyProfile) DirectionKeyLength() int
type EncryptedFragment ¶
func ParseEncryptedFragment ¶
func ParseEncryptedFragment(data []byte) (EncryptedFragment, error)
func (EncryptedFragment) MarshalBinary ¶
func (f EncryptedFragment) MarshalBinary() ([]byte, error)
type FullAuthConfig ¶
type FullAuthConfig struct {
Transport InitTransport
Init InitResult
Keys IKEKeys
SIM sim.AKAProvider
EAPKeys eapaka.Keys
InitiatorID Identity
EAPIdentity string
EAPPseudonym string
EAPReauthIdentity string
EAPReauthCounter uint16
EAPReauthCounterOK bool
ChildSA SecurityAssociation
ChildSPI []byte
TSi TrafficSelectors
TSr TrafficSelectors
Configuration Configuration
Random io.Reader
InitialIV []byte
EAPIdentityIV []byte
EAPReauthIV []byte
InitialMessageID uint32
}
type FullAuthResult ¶
type FullAuthResult struct {
Auth AuthResult
IdentityExchanges []EAPIdentityExchange
AKAChallenges []AKAChallengeResult
ChildSA *ChildSAResult
EAPKeys eapaka.Keys
EAPLast *eapaka.Packet
EAPNotifications []eapaka.Packet
EAPClientError bool
EAPNextPseudonym string
EAPNextReauthID string
EAPReauthenticated bool
EAPReauthCounter uint16
EAPReauthCounterTooSmall bool
SyncFailure bool
AuthFailure bool
KDFNegotiations int
NextMessageID uint32
FinalResponseBytes []byte
FinalResponseInner []Payload
}
func RunIKE_AUTH_Full ¶
func RunIKE_AUTH_Full(ctx context.Context, cfg FullAuthConfig) (FullAuthResult, error)
type Header ¶
type Header struct {
InitiatorSPI uint64
ResponderSPI uint64
NextPayload uint8
Version uint8
ExchangeType uint8
Flags uint8
MessageID uint32
Length uint32
}
func ParseHeader ¶
func (Header) MarshalBinary ¶
type IKEKeys ¶
type IKEKeys struct {
Profile KeyMaterialProfile
SKD []byte
SKAi []byte
SKAr []byte
SKEi []byte
SKEr []byte
SKPi []byte
SKPr []byte
}
func SplitIKEKeys ¶
func SplitIKEKeys(profile KeyMaterialProfile, keyMaterial []byte) (IKEKeys, error)
type InformationalConfig ¶
type InformationalConfig struct {
Transport InitTransport
Init InitResult
Keys IKEKeys
MessageID uint32
FromResponder bool
Payloads []Payload
Random io.Reader
IV []byte
}
type InformationalContent ¶
type InformationalContent struct {
Payloads []Payload
Notifies []Notify
NotifyActions []NotifyAction
Deletes []Delete
NotifyError error
}
func ParseInformationalContent ¶
func ParseInformationalContent(payloads []Payload) (InformationalContent, error)
type InformationalHandling ¶
type InformationalHandling struct {
Empty bool
LivenessCheck bool
DeleteIKE bool
DeleteESP [][]byte
DeleteAH [][]byte
UpdateSAAddresses bool
NoAdditionalAddresses bool
AdditionalAddresses []net.IP
Cookie2 []byte
InvalidSelectors []InvalidSelectorReport
NotifyError error
Notifies []Notify
NotifyActions []NotifyAction
Deletes []Delete
}
func HandleInformationalContent ¶
func HandleInformationalContent(content InformationalContent) (InformationalHandling, error)
func HandleInformationalPayloads ¶
func HandleInformationalPayloads(payloads []Payload) (InformationalHandling, error)
type InformationalRecoveryAction ¶
type InformationalRecoveryAction uint8
const ( InformationalRecoveryNoAction InformationalRecoveryAction = iota InformationalRecoveryUpdateMOBIKEAddresses InformationalRecoveryMOBIKEAddressRecovery InformationalRecoveryRekeyChildSA InformationalRecoveryRetryExchange InformationalRecoveryWaitAndRetry InformationalRecoveryRecreateChildSA InformationalRecoveryRecreateIKESA InformationalRecoveryReauthenticate InformationalRecoveryAbort )
func (InformationalRecoveryAction) String ¶
func (a InformationalRecoveryAction) String() string
type InformationalRecoveryPlan ¶
type InformationalRecoveryPlan struct {
Action InformationalRecoveryAction
Reason string
Retry bool
RetryLater bool
RecreateIKE bool
RecreateChild bool
RekeyChild bool
Reauthenticate bool
MOBIKEAddressRecovery bool
SuggestedDHGroup uint16
EchoCookie2 bool
DeleteIKE bool
DeleteCurrentChild bool
DeleteOtherChild bool
UpdateSAAddresses bool
Response InformationalResponsePlan
ChildDeletes ChildSADeleteSummary
NotifyActions []NotifyAction
}
func PlanInformationalRecovery ¶
func PlanInformationalRecovery(content InformationalContent, child ChildSAResult) (InformationalRecoveryPlan, error)
func PlanInformationalRecoveryPayloads ¶
func PlanInformationalRecoveryPayloads(payloads []Payload, child ChildSAResult) (InformationalRecoveryPlan, error)
type InformationalResponsePlan ¶
func PlanInformationalResponse ¶
func PlanInformationalResponse(handling InformationalHandling) (InformationalResponsePlan, error)
type InformationalResult ¶
type InformationalResult struct {
RequestBytes []byte
ResponseBytes []byte
ResponseInner []Payload
Response InformationalContent
NextMessageID uint32
}
func RunInformationalExchange ¶
func RunInformationalExchange(ctx context.Context, cfg InformationalConfig) (InformationalResult, error)
func RunLivenessCheck ¶
func RunLivenessCheck(ctx context.Context, cfg InformationalConfig) (InformationalResult, error)
type InitConfig ¶
type InitResult ¶
type InitResult struct {
RequestBytes []byte
ResponseBytes []byte
Request Message
Response Message
SelectedSA SecurityAssociation
InitiatorSPI uint64
ResponderSPI uint64
NonceI []byte
NonceR []byte
PublicKeyI []byte
PublicKeyR []byte
PRF crypto.Hash
SKEYSEED []byte
KeyMaterial []byte
Keys IKEKeys
MOBIKESupported bool
NATDetected bool
}
func RunIKE_SA_INIT ¶
func RunIKE_SA_INIT(ctx context.Context, cfg InitConfig) (InitResult, error)
type InitTransport ¶
type InvalidSelectorReport ¶
func InvalidSelectorReportFromError ¶
func InvalidSelectorReportFromError(err error) (InvalidSelectorReport, bool, error)
type KeyExchange ¶
func ParseKeyExchange ¶
func ParseKeyExchange(data []byte) (KeyExchange, error)
func (KeyExchange) MarshalBinary ¶
func (k KeyExchange) MarshalBinary() []byte
type KeyMaterialProfile ¶
type KeyMaterialProfile struct {
PRF crypto.Hash
EncryptionID uint16
EncryptionKeyLength int
EncryptionBlockSize int
IntegrityID uint16
IntegrityKeyLength int
IntegrityChecksumLength int
PRFKeyLength int
}
func KeyMaterialProfileFromSA ¶
func KeyMaterialProfileFromSA(sa SecurityAssociation) (KeyMaterialProfile, error)
func (KeyMaterialProfile) RequiredLength ¶
func (p KeyMaterialProfile) RequiredLength() int
type Message ¶
func ParseMessage ¶
func ProtectMessage ¶
func (Message) MarshalBinary ¶
type Notify ¶
func ParseNotify ¶
func (Notify) InvalidKEPayloadAlternativeGroup ¶
InvalidKEPayloadAlternativeGroup returns the responder's suggested DH group when this notification is INVALID_KE_PAYLOAD.
func (Notify) InvalidSelectorReport ¶
func (n Notify) InvalidSelectorReport() (InvalidSelectorReport, bool, error)
func (Notify) MarshalBinary ¶
type NotifyAction ¶
type NotifyAction struct {
Notify Notify
Kind NotifyActionKind
Retry bool
RetryLater bool
RecreateIKE bool
RecreateChild bool
SuggestedDHGroup uint16
}
func ClassifyNotifyAction ¶
func ClassifyNotifyAction(notify Notify) NotifyAction
func CreateChildSANotifyActionFromError ¶
func CreateChildSANotifyActionFromError(err error) (NotifyAction, bool)
func NotifyActionFromError ¶
func NotifyActionFromError(err error) (NotifyAction, bool)
type NotifyActionKind ¶
type NotifyActionKind uint8
const ( NotifyActionNone NotifyActionKind = iota NotifyActionMOBIKESupported NotifyActionMOBIKEUpdateAddresses NotifyActionMOBIKEAdditionalAddress NotifyActionMOBIKENoAdditionalAddresses NotifyActionMOBIKEEchoCookie2 NotifyActionRekeyChildSA NotifyActionRetryWithSuggestedDH NotifyActionRetryWithDifferentProposal NotifyActionNarrowTrafficSelectors NotifyActionRecreateChildSA NotifyActionRecreateIKESA NotifyActionMOBIKEAddressRecovery NotifyActionWaitAndRetry NotifyActionReauthenticate NotifyActionAbort )
type NotifyError ¶
func (*NotifyError) Error ¶
func (e *NotifyError) Error() string
func (*NotifyError) InvalidKEPayloadAlternativeGroup ¶
func (e *NotifyError) InvalidKEPayloadAlternativeGroup() (uint16, bool, error)
InvalidKEPayloadAlternativeGroup returns the suggested DH group carried by an INVALID_KE_PAYLOAD notify error.
func (*NotifyError) InvalidSelectorReport ¶
func (e *NotifyError) InvalidSelectorReport() (InvalidSelectorReport, bool, error)
func (*NotifyError) Is ¶
func (e *NotifyError) Is(target error) bool
func (*NotifyError) Unwrap ¶
func (e *NotifyError) Unwrap() error
type Payload ¶
func BuildCreateChildSAPayloads ¶
func BuildCreateChildSAPayloads(cfg CreateChildSAConfig) ([]Payload, []byte, []byte, error)
func BuildIKEAuthInitialPayloads ¶
func BuildIKEAuthInitialPayloads(cfg AuthConfig) ([]Payload, error)
func ChildSADeletePayload ¶
func ChildSADeletePayload(child ChildSAResult) (Payload, error)
func ConfigurationPayload ¶
func ConfigurationPayload(c Configuration) (Payload, error)
func Cookie2Notify ¶
func CookieNotify ¶
func DeletePayload ¶
func EAPPayload ¶
func ESPDeletePayload ¶
func EncryptedFragmentPayload ¶
func EncryptedFragmentPayload(nextPayload uint8, fragment EncryptedFragment) (Payload, error)
func IKEDeletePayload ¶
func IKEDeletePayload() Payload
func KeyExchangePayload ¶
func MOBIKESupportedNotify ¶
func MOBIKESupportedNotify() Payload
func NATDetectionNotify ¶
func NoAdditionalAddressesNotify ¶
func NoAdditionalAddressesNotify() Payload
func NoncePayload ¶
func NotifyPayload ¶
func NotifyWithZeroSPI ¶
func SecurityAssociationPayload ¶
func SecurityAssociationPayload(sa SecurityAssociation) (Payload, error)
func TeardownDeletePayloads ¶
func TeardownDeletePayloads(child ChildSAResult, includeIKESA bool) ([]Payload, error)
func TrafficSelectorsPayload ¶
func TrafficSelectorsPayload(payloadType uint8, ts TrafficSelectors) (Payload, error)
func UpdateSAAddressesNotify ¶
func UpdateSAAddressesNotify() Payload
type SecurityAssociation ¶
type SecurityAssociation struct {
Proposals []Proposal
}
func DefaultESPProposal ¶
func DefaultESPProposal(spi []byte) SecurityAssociation
func DefaultIKEProposal ¶
func DefaultIKEProposal() SecurityAssociation
func ParseSecurityAssociation ¶
func ParseSecurityAssociation(data []byte) (SecurityAssociation, error)
func (SecurityAssociation) MarshalBinary ¶
func (sa SecurityAssociation) MarshalBinary() ([]byte, error)
type TrafficSelector ¶
type TrafficSelector struct {
Type uint8
IPProtocol uint8
StartPort uint16
EndPort uint16
StartAddr net.IP
EndAddr net.IP
}
func (TrafficSelector) MarshalBinary ¶
func (ts TrafficSelector) MarshalBinary() ([]byte, error)
type TrafficSelectors ¶
type TrafficSelectors struct {
Selectors []TrafficSelector
}
func IPv4AnyTrafficSelectors ¶
func IPv4AnyTrafficSelectors() TrafficSelectors
func ParseTrafficSelectors ¶
func ParseTrafficSelectors(data []byte) (TrafficSelectors, error)
func (TrafficSelectors) MarshalBinary ¶
func (ts TrafficSelectors) MarshalBinary() ([]byte, error)
type Transform ¶
type Transform struct {
Type uint8
ID uint16
Attributes []TransformAttribute
}
type TransformAttribute ¶
func KeyLengthAttribute ¶
func KeyLengthAttribute(bits uint16) TransformAttribute
Click to show internal directories.
Click to hide internal directories.