mschapv2

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const TypeMSCHAPv2 protocol.Type = 26

Variables

This section is empty.

Functions

func DebugStaticCredentials

func DebugStaticCredentials(user, password []byte) func(req AuthRequest) (*AuthResponse, error)

func Protocol

func Protocol() protocol.Payload

Types

type AuthRequest

type AuthRequest struct {
	Challenge     []byte
	PeerChallenge []byte
}

type AuthResponse

type AuthResponse struct {
	NTResponse            []byte
	RecvKey               []byte
	SendKey               []byte
	AuthenticatorResponse string
}

type OpCode

type OpCode uint8
const (
	OpChallenge OpCode = 1
	OpResponse  OpCode = 2
	OpSuccess   OpCode = 3
)

type Payload

type Payload struct {
	OpCode     OpCode
	MSCHAPv2ID uint8
	MSLength   uint16
	ValueSize  uint8

	Challenge []byte
	Response  []byte

	Name []byte
	// contains filtered or unexported fields
}

func (*Payload) Decode

func (p *Payload) Decode(raw []byte) error

func (*Payload) Encode

func (p *Payload) Encode() ([]byte, error)

func (*Payload) Handle

func (p *Payload) Handle(ctx protocol.Context) protocol.Payload

func (*Payload) ModifyRADIUSResponse

func (p *Payload) ModifyRADIUSResponse(r *radius.Packet, q *radius.Packet) error

func (*Payload) Offerable

func (p *Payload) Offerable() bool

func (*Payload) String

func (p *Payload) String() string

func (*Payload) Type

func (p *Payload) Type() protocol.Type

type Response

type Response struct {
	Challenge  []byte
	NTResponse []byte
	Flags      uint8
}

func ParseResponse

func ParseResponse(raw []byte) (*Response, error)

type Settings

type Settings struct {
	AuthenticateRequest func(req AuthRequest) (*AuthResponse, error)
	ServerIdentifier    string
}

type State

type State struct {
	Challenge       []byte
	PeerChallenge   []byte
	IsProtocolEnded bool
	AuthResponse    *AuthResponse
}

type SuccessRequest

type SuccessRequest struct {
	*Payload
	Authenticator []byte
}

func (*SuccessRequest) Encode

func (sr *SuccessRequest) Encode() ([]byte, error)

A success request is encoded slightly differently, it doesn't have a challenge and as such doesn't need to encode the length of it

Jump to

Keyboard shortcuts

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