more mschap v2, start peap extension type 33

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer
2025-05-24 01:25:09 +02:00
parent e0c837257c
commit fad18db70b
8 changed files with 275 additions and 5 deletions

View File

@ -0,0 +1,26 @@
package mschapv2
import (
"bytes"
"errors"
"layeh.com/radius/rfc2759"
)
func (p *Payload) checkChapPassword(res *Response) ([]byte, error) {
byteUser := []byte("foo")
bytePwd := []byte("bar")
ntResponse, err := rfc2759.GenerateNTResponse(p.st.Challenge, p.st.PeerChallenge, byteUser, bytePwd)
if err != nil {
return nil, err
}
if !bytes.Equal(ntResponse, res.NTResponse) {
return nil, errors.New("nt response mismatch")
}
authenticatorResponse, err := rfc2759.GenerateAuthenticatorResponse(p.st.Challenge, p.st.PeerChallenge, ntResponse, byteUser, bytePwd)
if err != nil {
return nil, err
}
return []byte(authenticatorResponse), nil
}