github.com/Psiphon-Labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/upstreamproxy/go-ntlm/README.md (about) 1 2 This is a fork of the package that previously existed at https://github.com/ThomsonReutersEikon/go-ntlm/ntlm. It contains several bug fixes, tagged with "[Psiphon]". 3 4 Original github.com/ThomsonReutersEikon/go-ntlm/ntlm README: 5 6 # NTLM Implementation for Go 7 8 This is a native implementation of NTLM for Go that was implemented using the Microsoft MS-NLMP documentation available at http://msdn.microsoft.com/en-us/library/cc236621.aspx. 9 The library is currently in use and has been tested with connectionless NTLMv1 and v2 with and without extended session security. 10 11 ## Usage Notes 12 13 Currently the implementation only supports connectionless (datagram) oriented NTLM. We did not need connection oriented NTLM for our usage 14 and so it is not implemented. However it should be extremely straightforward to implement connection oriented NTLM as all 15 the operations required are present in the library. The major missing piece is the negotiation of capabilities between 16 the client and the server, for our use we hardcoded a supported set of negotiation flags. 17 18 ## Sample Usage as NTLM Client 19 20 ```go 21 import "github.com/ThomsonReutersEikon/go-ntlm/ntlm" 22 23 session, err = ntlm.CreateClientSession(ntlm.Version2, ntlm.ConnectionlessMode) 24 session.SetUserInfo("someuser","somepassword","somedomain") 25 26 negotiate := session.GenerateNegotiateMessage() 27 28 <send negotiate to server> 29 30 challenge, err := ntlm.ParseChallengeMessage(challengeBytes) 31 session.ProcessChallengeMessage(challenge) 32 33 authenticate := session.GenerateAuthenticateMessage() 34 35 <send authenticate message to server> 36 ``` 37 38 ## Sample Usage as NTLM Server 39 40 ```go 41 session, err := ntlm.CreateServerSession(ntlm.Version1, ntlm.ConnectionlessMode) 42 session.SetUserInfo("someuser","somepassword","somedomain") 43 44 challenge := session.GenerateChallengeMessage() 45 46 <send challenge to client> 47 48 <receive authentication bytes> 49 50 auth, err := ntlm.ParseAuthenticateMessage(authenticateBytes) 51 session.ProcessAuthenticateMessage(auth) 52 ``` 53 54 ## Generating a message MAC 55 56 Once a session is created you can generate the Mac for a message using: 57 58 ```go 59 message := "this is some message to sign" 60 sequenceNumber := 100 61 signature, err := session.Mac([]byte(message), sequenceNumber) 62 ``` 63 64 ## License 65 Copyright Thomson Reuters Global Resources 2013 66 Apache License