1 #ifndef HEADER_CURL_NTLM_MSGS_H
2 #define HEADER_CURL_NTLM_MSGS_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ***************************************************************************/
25 #include "curl_setup.h"
29 /* This is to generate a base64 encoded NTLM type-1 message */
30 CURLcode Curl_ntlm_create_type1_message(const char *userp,
32 struct ntlmdata *ntlm,
36 /* This is to generate a base64 encoded NTLM type-3 message */
37 CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
40 struct ntlmdata *ntlm,
44 /* This is to decode a NTLM type-2 message */
45 CURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data,
47 struct ntlmdata* ntlm);
49 /* This is to clean up the ntlm data structure */
50 #ifdef USE_WINDOWS_SSPI
51 void Curl_ntlm_sspi_cleanup(struct ntlmdata *ntlm);
53 #define Curl_ntlm_sspi_cleanup(x)
56 /* NTLM buffer fixed size, large enough for long user + host + domain */
57 #define NTLM_BUFSIZE 1024
59 /* Stuff only required for curl_ntlm_msgs.c */
60 #ifdef BUILDING_CURL_NTLM_MSGS_C
62 /* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */
64 #define NTLMFLAG_NEGOTIATE_UNICODE (1<<0)
65 /* Indicates that Unicode strings are supported for use in security buffer
68 #define NTLMFLAG_NEGOTIATE_OEM (1<<1)
69 /* Indicates that OEM strings are supported for use in security buffer data. */
71 #define NTLMFLAG_REQUEST_TARGET (1<<2)
72 /* Requests that the server's authentication realm be included in the Type 2
76 #define NTLMFLAG_NEGOTIATE_SIGN (1<<4)
77 /* Specifies that authenticated communication between the client and server
78 should carry a digital signature (message integrity). */
80 #define NTLMFLAG_NEGOTIATE_SEAL (1<<5)
81 /* Specifies that authenticated communication between the client and server
82 should be encrypted (message confidentiality). */
84 #define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE (1<<6)
85 /* Indicates that datagram authentication is being used. */
87 #define NTLMFLAG_NEGOTIATE_LM_KEY (1<<7)
88 /* Indicates that the LAN Manager session key should be used for signing and
89 sealing authenticated communications. */
91 #define NTLMFLAG_NEGOTIATE_NETWARE (1<<8)
94 #define NTLMFLAG_NEGOTIATE_NTLM_KEY (1<<9)
95 /* Indicates that NTLM authentication is being used. */
99 #define NTLMFLAG_NEGOTIATE_ANONYMOUS (1<<11)
100 /* Sent by the client in the Type 3 message to indicate that an anonymous
101 context has been established. This also affects the response fields. */
103 #define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED (1<<12)
104 /* Sent by the client in the Type 1 message to indicate that a desired
105 authentication realm is included in the message. */
107 #define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED (1<<13)
108 /* Sent by the client in the Type 1 message to indicate that the client
109 workstation's name is included in the message. */
111 #define NTLMFLAG_NEGOTIATE_LOCAL_CALL (1<<14)
112 /* Sent by the server to indicate that the server and client are on the same
113 machine. Implies that the client may use a pre-established local security
114 context rather than responding to the challenge. */
116 #define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN (1<<15)
117 /* Indicates that authenticated communication between the client and server
118 should be signed with a "dummy" signature. */
120 #define NTLMFLAG_TARGET_TYPE_DOMAIN (1<<16)
121 /* Sent by the server in the Type 2 message to indicate that the target
122 authentication realm is a domain. */
124 #define NTLMFLAG_TARGET_TYPE_SERVER (1<<17)
125 /* Sent by the server in the Type 2 message to indicate that the target
126 authentication realm is a server. */
128 #define NTLMFLAG_TARGET_TYPE_SHARE (1<<18)
129 /* Sent by the server in the Type 2 message to indicate that the target
130 authentication realm is a share. Presumably, this is for share-level
131 authentication. Usage is unclear. */
133 #define NTLMFLAG_NEGOTIATE_NTLM2_KEY (1<<19)
134 /* Indicates that the NTLM2 signing and sealing scheme should be used for
135 protecting authenticated communications. */
137 #define NTLMFLAG_REQUEST_INIT_RESPONSE (1<<20)
138 /* unknown purpose */
140 #define NTLMFLAG_REQUEST_ACCEPT_RESPONSE (1<<21)
141 /* unknown purpose */
143 #define NTLMFLAG_REQUEST_NONNT_SESSION_KEY (1<<22)
144 /* unknown purpose */
146 #define NTLMFLAG_NEGOTIATE_TARGET_INFO (1<<23)
147 /* Sent by the server in the Type 2 message to indicate that it is including a
148 Target Information block in the message. */
156 #define NTLMFLAG_NEGOTIATE_128 (1<<29)
157 /* Indicates that 128-bit encryption is supported. */
159 #define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE (1<<30)
160 /* Indicates that the client will provide an encrypted master key in
161 the "Session Key" field of the Type 3 message. */
163 #define NTLMFLAG_NEGOTIATE_56 (1<<31)
164 /* Indicates that 56-bit encryption is supported. */
167 # define SECFLAG_WINNT_AUTH_IDENTITY \
168 (unsigned long)SEC_WINNT_AUTH_IDENTITY_UNICODE
170 # define SECFLAG_WINNT_AUTH_IDENTITY \
171 (unsigned long)SEC_WINNT_AUTH_IDENTITY_ANSI
174 #endif /* BUILDING_CURL_NTLM_MSGS_C */
176 #endif /* USE_NTLM */
178 #endif /* HEADER_CURL_NTLM_MSGS_H */