mschap

package
v0.0.0-...-46a5f05 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

MPPE to support encryption with MSCHAPv1

MPPE to support encryption with MSCHAPv2

mschap impl heavily inspired by https://github.com/FreeRADIUS/freeradius-server (C-code) Function naming same as https://tools.ietf.org/html/rfc2433 Appendix A - Pseudocode

Index

Constants

This section is empty.

Variables

View Source
var SHSpad1 = []byte{
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}

Pads used in key derivation

View Source
var SHSpad2 = []byte{
	0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2,
	0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2,
	0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2,
	0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2,
}

Functions

func Encryptv1

func Encryptv1(challenge []byte, pass string) ([]byte, error)

Encrypt MSCHAPv1 challenge+pass and return challengeresponse

func Mmpev2

func Mmpev2(secret string, pass string, reqAuth []byte, ntResponse []byte) ([]byte, []byte)

func Mppev1

func Mppev1(pass string) ([]byte, error)

Types

type ChallengeAttr

type ChallengeAttr struct {
	VendorId     uint32
	VendorType   uint8
	VendorLength uint8
	Value        []byte
}

func DecodeChallenge

func DecodeChallenge(b []byte) ChallengeAttr

type Res

type Res struct {
	ChallengeResponse     []byte
	AuthenticatorResponse string
}

func Encryptv2

func Encryptv2(authenticatorChallenge []byte, peerChallenge []byte, username string, pass string) (*Res, error)

GenerateNTResponse, GenerateAuthenticatorResponse

type Response2Attr

type Response2Attr struct {
	VendorId      uint32
	VendorType    uint8
	VendorLength  uint8
	Ident         uint8
	Flags         uint8
	PeerChallenge []byte //16bytes
	// 8bytes zero
	Response []byte //24bytes
}

func DecodeResponse2

func DecodeResponse2(b []byte) Response2Attr

type ResponseAttr

type ResponseAttr struct {
	VendorId     uint32
	VendorType   uint8
	VendorLength uint8
	Ident        uint8
	Flags        uint8
	LMResponse   []byte //24bytes
	NTResponse   []byte //24bytes
}

func DecodeResponse

func DecodeResponse(b []byte) ResponseAttr

Jump to

Keyboard shortcuts

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