header
import "github.com/TheManticoreProject/Manticore/crypto/spnego/ntlm/message/header"
Index
- Variables
- type Header
- func (m *Header) Expect(messageType types.MessageType) error
- func (m *Header) GetSignature() [8]byte
- func (m *Header) GetType() types.MessageType
- func (m *Header) Marshal() ([]byte, error)
- func (m *Header) SetSignature(signature [8]byte)
- func (m *Header) SetType(messageType types.MessageType)
- func (m *Header) Unmarshal(data []byte) (int, error)
Variables
NTLM signature
var NTLM_SIGNATURE = [8]byte{'N', 'T', 'L', 'M', 'S', 'S', 'P', 0}
type Header
Header is the header of an NTLM message
type Header struct {
// Signature (8 bytes): An 8-byte character array that MUST contain the ASCII string ('N', 'T', 'L', 'M', 'S', 'S', 'P', '\0').
Signature [8]byte
// MessageType (4 bytes): A 32-bit unsigned integer that indicates the message type.
MessageType types.MessageType
}
func (*Header) Expect
func (m *Header) Expect(messageType types.MessageType) error
Expect reports whether the header names the message type the caller is parsing.
The three NTLM messages have different layouts and no shared discriminator beyond this field, so parsing one as another produces a message populated from the wrong offsets rather than an error.
func (*Header) GetSignature
func (m *Header) GetSignature() [8]byte
GetSignature returns the signature
func (*Header) GetType
func (m *Header) GetType() types.MessageType
GetType returns the message type
func (*Header) Marshal
func (m *Header) Marshal() ([]byte, error)
Marshal serializes the Header into a byte slice
func (*Header) SetSignature
func (m *Header) SetSignature(signature [8]byte)
SetSignature sets the signature
func (*Header) SetType
func (m *Header) SetType(messageType types.MessageType)
SetType sets the message type
func (*Header) Unmarshal
func (m *Header) Unmarshal(data []byte) (int, error)
Unmarshal deserializes a byte slice into a Header
The signature is checked rather than merely copied. Everything that follows it is read at fixed offsets and at offsets the message itself declares, so a buffer that is not an NTLM message at all is otherwise parsed as one: the fields come out as whatever the bytes happened to say, and the caller has no way to tell. Refusing here means a parse failure is reported where it happens.