Versions in this module Expand all Collapse all v1 v1.1.1 Dec 20, 2024 Changes in this version type Config + func (c *Config) Copy() gssapi.MechanismConfig v1.1.0 Dec 13, 2024 v1.0.5 Oct 29, 2024 v1.0.4 Oct 16, 2024 v1.0.3 Sep 13, 2024 v1.0.2 Jul 18, 2024 v1.0.1 May 28, 2024 Changes in this version + func IsCredentialEmpty(cred any) bool + func IsValidCredential(cred any) bool v1.0.0 Apr 30, 2024 v0 v0.1.0 Apr 30, 2024 Changes in this version + const AccountAuthenticationConstrained + const MICProvided + const NTLMv1 + const NTLMv2 + const SPNFromUntrustedSource + const SignatureVersion + const WindowsMajorVersion10 + const WindowsMajorVersion5 + const WindowsMajorVersion6 + const WindowsMinorVersion0 + const WindowsMinorVersion1 + const WindowsMinorVersion2 + const WindowsMinorVersion3 + var AttrIDList = [...]AttrValueID + var DefaultVersion = Version + var Err128BitEncryptionNotSupported = errors.New("128-bit encryption was requested but not supported") + var ErrConfidentialityNotAvailable = errors.New("confidentiality was requested but not available") + var ErrDelegationNotSupported = errors.New("delegation is not supported") + var ErrIntegrityNotAvailable = errors.New("integrity, replay_detection, or sequencing were requested but not available") + var ErrInvalidMessageType = errors.New("unexpected message type") + var ErrInvalidNTLMSignature = errors.New("invalid ntlmssp signature, expected 'NTLMSSP'") + var ErrLogonFailure = errors.New("logon failure") + var ErrMutualAuthnNotSupported = errors.New("mutual authn is not supported") + var MechanismType = gssapi.OID + var NTLMSignature = []byte + var Windows10 = ProductVersion + var Windows7 = ProductVersion + var Windows8 = ProductVersion + var Windows8_1 = ProductVersion + var WindowsServer2003 = ProductVersion + var WindowsServer2008 = ProductVersion + var WindowsServer2008R2 = ProductVersion + var WindowsServer2012 = ProductVersion + var WindowsServer2012R2 = ProductVersion + var WindowsServer2016_2019 = ProductVersion + var WindowsVista = ProductVersion + var WindowsXPSP2 = ProductVersion + func CRC32(key []byte) func(uint32) hash.Hash + func HMACMD5(key []byte) func(uint32) hash.Hash + func RC4K(ctx context.Context, key []byte, src []byte) ([]byte, error) + type AttrFlag uint32 + func (f AttrFlag) IsSet(ff AttrFlag) bool + type AttrValueID uint16 + const AttrChannelBindings + const AttrDNSComputerName + const AttrDNSDomainName + const AttrDNSTreeName + const AttrEOL + const AttrFlags + const AttrNetBIOSComputerName + const AttrNetBIOSDomainName + const AttrSingleHost + const AttrTargetName + const AttrTimestamp + type AttrValues map[AttrValueID]*Value + func (avl *AttrValues) Marshal(ctx context.Context) ([]byte, error) + func (avl *AttrValues) Unmarshal(ctx context.Context, b []byte) error + func (avl AttrValues) Flag() AttrFlag + func (avl AttrValues) HasAttr(attr AttrValueID) bool + func (avl AttrValues) Timestamp() Filetime + func (avl AttrValues) ToValue() *Value + type AuthLevel int + const LMv1AndNTLMv1 + const LMv1AndNTLMv1WithESS + const NTLMv1WithESS + const NTLMv2WithESS + type AuthenticateMessage struct + DomainName string + DomainNameLen uint16 + DomainNameMaxLen uint16 + DomainNameOffset uint32 + EncryptedRandomSessionKey []byte + EncryptedRandomSessionKeyLen uint16 + EncryptedRandomSessionKeyMaxLen uint16 + EncryptedRandomSessionKeyOffset uint32 + LMChallengeResponse []byte + LMChallengeResponseLen uint16 + LMChallengeResponseMaxLen uint16 + LMChallengeResponseOffset uint32 + MIC []byte + MessageType MessageType + NTChallengeResponse []byte + NTChallengeResponseLen uint16 + NTChallengeResponseMaxLen uint16 + NTChallengeResponseOffset uint32 + Negotiate Flag + Signature []byte + UserName string + UserNameLen uint16 + UserNameMaxLen uint16 + UserNameOffset uint32 + Version Version + Workstation string + WorkstationLen uint16 + WorkstationMaxLen uint16 + WorkstationOffset uint32 + func (m *AuthenticateMessage) Marshal(ctx context.Context) ([]byte, error) + func (m *AuthenticateMessage) Unmarshal(ctx context.Context, b []byte) error + type Authentifier struct + Config *Config + func (a *Authentifier) ApplyInboundCipher(ctx context.Context, b []byte) error + func (a *Authentifier) ApplyOutboundCipher(ctx context.Context, b []byte) error + func (a *Authentifier) Authenticate(ctx context.Context, b []byte) ([]byte, error) + func (a *Authentifier) MakeInboundChecksum(ctx context.Context, b [][]byte) ([]byte, error) + func (a *Authentifier) MakeInboundSignature(ctx context.Context, checksum []byte) ([]byte, error) + func (a *Authentifier) MakeOutboundChecksum(ctx context.Context, b [][]byte) ([]byte, error) + func (a *Authentifier) MakeOutboundSignature(ctx context.Context, checksum []byte) ([]byte, error) + func (a *Authentifier) Negotiate(ctx context.Context) ([]byte, error) + func (a *Authentifier) Reset() + func (a *Authentifier) ResetSecurityService(ctx context.Context) error + func (a *Authentifier) SessionKey() []byte + func (a *Authentifier) TargetName() string + type ChallengeMessage struct + MessageType MessageType + Negotiate Flag + ServerChallenge []byte + Signature []byte + TargetInfo AttrValues + TargetInfoLen uint16 + TargetInfoMaxLen uint16 + TargetInfoOffset uint32 + TargetName string + TargetNameLen uint16 + TargetNameMaxLen uint16 + TargetNameOffset uint32 + Version Version + func (m *ChallengeMessage) Marshal(ctx context.Context) ([]byte, error) + func (m *ChallengeMessage) Unmarshal(ctx context.Context, b []byte) error + type ChallengeResponse struct + IsAnonymous bool + KeyExchangeKey []byte + KeyLM []byte + KeyNT []byte + LM []byte + NT []byte + RequestMIC bool + SessionBaseKey []byte + Tmp []byte + type Cipher struct + func NewCipher(ctx context.Context, key []byte, hashFunc func(uint32) hash.Hash) (*Cipher, error) + func (c *Cipher) Checksum(seqNum uint32, ms ...[]byte) ([]byte, error) + func (c *Cipher) XORKeyStream(data any) error + type Config struct + Anonymity bool + ChannelBindings []byte + ClientConfigFlags Flag + Confidentiality bool + Credential Credential + Datagram bool + Identify bool + Integrity bool + IsServer bool + MaxLifetime time.Duration + NTLMVersion int + NoESS bool + NoLMResponse bool + NoSignAllBuffers bool + RequestMIC bool + Require128BitEncryption bool + TargetName string + UnverifiedTargetName bool + Version Version + func NewConfig() *Config + func NewConfigFromAuthLevel(lvl AuthLevel) *Config + func (Config) Type() gssapi.OID + func (c *Config) Negotiate() Flag + func (c *Config) NewNTLMVersion(ctx context.Context, cfg *Config, sess *SecurityParameters) NTLMVersion + func (c *Config) Verify(f Flag) error + type Credential = credential.Password + type Filetime uint64 + func TimeToFiletime(t time.Time) Filetime + func (ft Filetime) AsTime() time.Time + type Flag uint32 + const Anonymous + const Negotiate128 + const Negotiate56 + const NegotiateAlwaysSign + const NegotiateDatagram + const NegotiateExtendedSessionSecurity + const NegotiateIdentify + const NegotiateKeyExchange + const NegotiateLMKey + const NegotiateNTLM + const NegotiateOEM + const NegotiateOEMDomainSupplied + const NegotiateOEMWorkstationSupplied + const NegotiateSeal + const NegotiateSign + const NegotiateTargetInfo + const NegotiateUnicode + const NegotiateVersion + const R1 + const R10 + const R2 + const R3 + const R4 + const R5 + const R6 + const R7 + const R8 + const R9 + const RequestNonNTSessionKey + const RequestTarget + const TargetTypeDomain + const TargetTypeServer + func (f Flag) IsSet(ff Flag) bool + func (f Flag) Set(ff Flag) Flag + func (f Flag) Unset(ff Flag) Flag + type LMv1Response struct + Response []byte + func (m *LMv1Response) Marshal(ctx context.Context) ([]byte, error) + func (m *LMv1Response) Unmarshal(ctx context.Context, b []byte) error + type LMv2Response struct + ChallengeFromClient []byte + Response []byte + func (m *LMv2Response) Marshal(ctx context.Context) ([]byte, error) + func (m *LMv2Response) Unmarshal(ctx context.Context, b []byte) error + type MachineID []byte + type Mechanism struct + func (Mechanism) DefaultConfig(ctx context.Context) (gssapi.MechanismConfig, error) + func (Mechanism) New(ctx context.Context) (gssapi.Mechanism, error) + func (Mechanism) Type() gssapi.OID + func (m *Mechanism) Accept(ctx context.Context, tok *gssapi.Token) (*gssapi.Token, error) + func (m *Mechanism) Init(ctx context.Context, tok *gssapi.Token) (*gssapi.Token, error) + func (m *Mechanism) MakeSignature(ctx context.Context, tok *gssapi.MessageToken) (*gssapi.MessageToken, error) + func (m *Mechanism) MakeSignatureEx(ctx context.Context, tokEx *gssapi.MessageTokenEx) (*gssapi.MessageTokenEx, error) + func (m *Mechanism) Unwrap(ctx context.Context, tok *gssapi.MessageToken) (*gssapi.MessageToken, error) + func (m *Mechanism) UnwrapEx(ctx context.Context, tokEx *gssapi.MessageTokenEx) (*gssapi.MessageTokenEx, error) + func (m *Mechanism) VerifySignature(ctx context.Context, tok *gssapi.MessageToken) error + func (m *Mechanism) VerifySignatureEx(ctx context.Context, tokEx *gssapi.MessageTokenEx) error + func (m *Mechanism) Wrap(ctx context.Context, tok *gssapi.MessageToken) (*gssapi.MessageToken, error) + func (m *Mechanism) WrapEx(ctx context.Context, tokEx *gssapi.MessageTokenEx) (*gssapi.MessageTokenEx, error) + func (m *Mechanism) WrapSizeLimit(ctx context.Context, sz int, conf bool) int + type MessageType uint32 + const MessageTypeAuthenticate + const MessageTypeChallenge + const MessageTypeNegotiate + const MessageTypeNone + type NTLMVersion interface + ChallengeResponse func(context.Context, Credential, *ChallengeMessage, []byte) (*ChallengeResponse, error) + KeyExchangeKey func(context.Context, *ChallengeMessage, *ChallengeResponse) ([]byte, error) + LMOWF func(context.Context, Credential) ([]byte, error) + NTOWF func(context.Context, Credential) ([]byte, error) + WithConfig func(context.Context, *Config) NTLMVersion + type NTLMv1Response = LMv1Response + type NTLMv2ClientChallenge struct + AttrValues AttrValues + ChallengeFromClient []byte + HiRespType uint8 + RespType uint8 + Timestamp Filetime + func (m *NTLMv2ClientChallenge) Marshal(ctx context.Context) ([]byte, error) + func (m *NTLMv2ClientChallenge) Unmarshal(ctx context.Context, b []byte) error + type NTLMv2Response struct + NTLMv2ClientChallenge *NTLMv2ClientChallenge + Response []byte + func (m *NTLMv2Response) Marshal(ctx context.Context) ([]byte, error) + func (m *NTLMv2Response) Unmarshal(ctx context.Context, b []byte) error + type NegotiateMessage struct + DomainName string + DomainNameLen uint16 + DomainNameMaxLen uint16 + DomainNameOffset uint32 + MessageType MessageType + Negotiate Flag + Signature []byte + Version Version + Workstation string + WorkstationLen uint16 + WorkstationMaxLen uint16 + WorkstationOffset uint32 + func (m *NegotiateMessage) Marshal(ctx context.Context) ([]byte, error) + func (m *NegotiateMessage) Unmarshal(ctx context.Context, b []byte) error + type ProductVersion struct + Major uint8 + Minor uint8 + type Revision uint8 + const RevisionCurrent + type SecurityParameters struct + Datagram bool + DomainName string + ExtendedSessionSecurity bool + KeyExchange bool + KeySize int + NonNTSessionKey bool + ServerName string + UseLMKey bool + type SecurityService struct + ClientSealKey []byte + ClientSignKey []byte + ExportedSessionKey []byte + InboundCipher *Cipher + InboundSequenceNumber uint32 + OutboundCipher *Cipher + OutboundSequenceNumber uint32 + ServerSealKey []byte + ServerSignKey []byte + type Signature struct + Checksum []byte + SeqNum uint32 + Version uint32 + func (s *Signature) Marshal(ctx context.Context) ([]byte, error) + func (s *Signature) Unmarshal(ctx context.Context, b []byte) error + type SingleHostData struct + CustomData []byte + MachineID MachineID + Size uint32 + func (v *SingleHostData) Marshal(ctx context.Context) ([]byte, error) + func (v *SingleHostData) Unmarshal(ctx context.Context, b []byte) error + type V1 struct + func (v1 *V1) ChallengeResponse(ctx context.Context, cred Credential, c *ChallengeMessage, nonce []byte) (*ChallengeResponse, error) + func (v1 *V1) KeyExchangeKey(ctx context.Context, c *ChallengeMessage, chal *ChallengeResponse) ([]byte, error) + func (v1 *V1) LMOWF(ctx context.Context, cred Credential) ([]byte, error) + func (v1 *V1) NTOWF(ctx context.Context, cred Credential) ([]byte, error) + func (v1 *V1) WithConfig(ctx context.Context, config *Config) NTLMVersion + type V2 struct + func (v2 *V2) ChallengeResponse(ctx context.Context, cred Credential, c *ChallengeMessage, nonce []byte) (*ChallengeResponse, error) + func (v2 *V2) KeyExchangeKey(ctx context.Context, c *ChallengeMessage, chal *ChallengeResponse) ([]byte, error) + func (v2 *V2) LMOWF(ctx context.Context, cred Credential) ([]byte, error) + func (v2 *V2) NTOWF(ctx context.Context, cred Credential) ([]byte, error) + func (v2 *V2) WithConfig(ctx context.Context, config *Config) NTLMVersion + type Value struct + ChannelBindings []byte + DNSComputerName string + DNSDomainName string + DNSTreeName string + Flag AttrFlag + NetBIOSComputerName string + NetBIOSDomainName string + SingleHostData *SingleHostData + TargetName string + Timestamp Filetime + func (v *Value) MarshalAttr(ctx context.Context, attrID AttrValueID) ([]byte, error) + func (v *Value) UnmarshalAttr(ctx context.Context, attrID AttrValueID, b []byte) error + type Version struct + ProductBuild uint16 + ProductVersion ProductVersion + Revision Revision + func (v Version) IsZero() bool