ntlm

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package ntlm provides a very basic implementation of the NTLMv2 protocol. It provides everything needed to authenticate a SMTP authentication request. This package is not feature complete and is intented to only provide the means required for go-mail to perform NTLM via SMTP authentication.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNTLMInvalidChallengeMessage is returned when the challenge message is invalid
	ErrNTLMInvalidChallengeMessage = errors.New("invalid challenge message")

	// ErrNTLMInvalidSignature is returned when the NTLM message signature is invalid
	ErrNTLMInvalidSignature = errors.New("invalid NTLM signature")

	// ErrNTLMInvalidMessageType is returned when the NTLM message type is invalid
	ErrNTLMInvalidMessageType = errors.New("invalid NTLM message type")
)
View Source
var ErrNTLMInvalidAVPair = errors.New("invalid NTLM attribute-value pair")

ErrNTLMInvalidAVPair indicates that an invalid NTLM attribute-value pair was encountered

View Source
var ErrNTLMInvalidPayload = errors.New("invalid NTLM payload")

ErrNTLMInvalidPayload is returned when the payload is invalid

Functions

func CreateChallengeMessage

func CreateChallengeMessage(clientFlags uint32, challenge []byte, targetName, domain string) ([]byte, error)

CreateChallengeMessage creates an NTLM challenge message (Type 2 message) for the given target name and domain

Types

type AuthenticateMessage

type AuthenticateMessage struct {
	// contains filtered or unexported fields
}

AuthenticateMessage represents the Type 3 message in the NTLM authentication process.

func (*AuthenticateMessage) Bytes

func (a *AuthenticateMessage) Bytes() []byte

Bytes returns the byte representation of the AuthenticateMessage type (Type 3 message)

See: https://curl.se/rfc/ntlm.html#theType3Message

type ChallengeMessage

type ChallengeMessage struct {
	// contains filtered or unexported fields
}

ChallengeMessage represents an NTLM challenge message (Type 2 message)

type NTLMv2Session

type NTLMv2Session struct {
	// contains filtered or unexported fields
}

NTLMv2Session represents a session using the NTLMv2 protocol.

func NewNTLMv2Session

func NewNTLMv2Session() *NTLMv2Session

NewNTLMv2Session returns a new NTLMv2Session.

func (*NTLMv2Session) GenerateAuthenticateMessage

func (s *NTLMv2Session) GenerateAuthenticateMessage() (*AuthenticateMessage, error)

GenerateAuthenticateMessage generates an NTLMv2 AuthenticateMessage (Type 3 message).

See: https://curl.se/rfc/ntlm.html#theType3Message

func (*NTLMv2Session) GenerateNegotiateMessage

func (s *NTLMv2Session) GenerateNegotiateMessage() (*NegotiateMessage, error)

GenerateNegotiateMessage generates a NTLMv2 negotiation message (Type 1 message).

See: https://curl.se/rfc/ntlm.html#theType1Message

func (*NTLMv2Session) ParseChallengeMessage

func (s *NTLMv2Session) ParseChallengeMessage(body []byte) error

ParseChallengeMessage parses an NTLM challenge message (Type 2 message) from the given body

See: https://curl.se/rfc/ntlm.html#theType2Message

func (*NTLMv2Session) SetUserInfo

func (s *NTLMv2Session) SetUserInfo(username, password, domain string)

SetUserInfo sets the user information for the NTLMv2Session.

type NegotiateMessage

type NegotiateMessage struct {
	// contains filtered or unexported fields
}

NegotiateMessage represents a NTLMv2 negotiate message (Type 1 message).

func (*NegotiateMessage) Bytes

func (nm *NegotiateMessage) Bytes() ([]byte, error)

Bytes returns the byte representation of the NTLMv2 negotiate message (Type 1 message).

type Payload

type Payload struct {
	// contains filtered or unexported fields
}

Payload represents a NTLM payload

Jump to

Keyboard shortcuts

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