1 .TH "Heimdal NTLM library" 3 "11 Jan 2012" "Version 1.5.2" "Heimdalntlmlibrary" \" -*- nroff -*-
5 Heimdal NTLM library \-
10 .RI "void \fBheim_ntlm_free_buf\fP (struct \fBntlm_buf\fP *p)"
13 .RI "void \fBheim_ntlm_free_targetinfo\fP (struct ntlm_targetinfo *ti)"
16 .RI "int \fBheim_ntlm_encode_targetinfo\fP (const struct ntlm_targetinfo *ti, int ucs2, struct \fBntlm_buf\fP *data)"
19 .RI "int \fBheim_ntlm_decode_targetinfo\fP (const struct \fBntlm_buf\fP *data, int ucs2, struct ntlm_targetinfo *ti)"
22 .RI "void \fBheim_ntlm_free_type1\fP (struct \fBntlm_type1\fP *data)"
25 .RI "int \fBheim_ntlm_encode_type1\fP (const struct \fBntlm_type1\fP *type1, struct \fBntlm_buf\fP *data)"
28 .RI "void \fBheim_ntlm_free_type2\fP (struct \fBntlm_type2\fP *data)"
31 .RI "int \fBheim_ntlm_encode_type2\fP (const struct \fBntlm_type2\fP *type2, struct \fBntlm_buf\fP *data)"
34 .RI "void \fBheim_ntlm_free_type3\fP (struct \fBntlm_type3\fP *data)"
37 .RI "int \fBheim_ntlm_encode_type3\fP (const struct \fBntlm_type3\fP *type3, struct \fBntlm_buf\fP *data)"
40 .RI "int \fBheim_ntlm_nt_key\fP (const char *password, struct \fBntlm_buf\fP *key)"
43 .RI "int \fBheim_ntlm_calculate_ntlm1\fP (void *key, size_t len, unsigned char challenge[8], struct \fBntlm_buf\fP *answer)"
46 .RI "int \fBheim_ntlm_build_ntlm1_master\fP (void *key, size_t len, struct \fBntlm_buf\fP *session, struct \fBntlm_buf\fP *master)"
49 .RI "int \fBheim_ntlm_build_ntlm2_master\fP (void *key, size_t len, struct \fBntlm_buf\fP *blob, struct \fBntlm_buf\fP *session, struct \fBntlm_buf\fP *master)"
52 .RI "int \fBheim_ntlm_keyex_unwrap\fP (struct \fBntlm_buf\fP *baseKey, struct \fBntlm_buf\fP *encryptedSession, struct \fBntlm_buf\fP *session)"
55 .RI "int \fBheim_ntlm_ntlmv2_key\fP (const void *key, size_t len, const char *username, const char *target, unsigned char ntlmv2[16])"
58 .RI "int \fBheim_ntlm_calculate_lm2\fP (const void *key, size_t len, const char *username, const char *target, const unsigned char serverchallenge[8], unsigned char ntlmv2[16], struct \fBntlm_buf\fP *answer)"
61 .RI "int \fBheim_ntlm_calculate_ntlm2\fP (const void *key, size_t len, const char *username, const char *target, const unsigned char serverchallenge[8], const struct \fBntlm_buf\fP *infotarget, unsigned char ntlmv2[16], struct \fBntlm_buf\fP *answer)"
64 .RI "int \fBheim_ntlm_verify_ntlm2\fP (const void *key, size_t len, const char *username, const char *target, time_t now, const unsigned char serverchallenge[8], const struct \fBntlm_buf\fP *answer, struct \fBntlm_buf\fP *infotarget, unsigned char ntlmv2[16])"
67 .SH "Detailed Description"
69 The NTLM core functions implement the string2key generation function, message encode and decode function, and the hash function functions.
70 .SH "Function Documentation"
72 .SS "int heim_ntlm_build_ntlm1_master (void * key, size_t len, struct \fBntlm_buf\fP * session, struct \fBntlm_buf\fP * master)"
74 Generates an NTLMv1 session random with assosited session master key.
78 \fIkey\fP the ntlm v1 key
80 \fIlen\fP length of key
82 \fIsession\fP generated session nonce, should be freed with \fBheim_ntlm_free_buf()\fP.
84 \fImaster\fP calculated session master key, should be freed with \fBheim_ntlm_free_buf()\fP.
89 In case of success 0 is return, an errors, a errno in what went wrong.
93 .SS "int heim_ntlm_build_ntlm2_master (void * key, size_t len, struct \fBntlm_buf\fP * blob, struct \fBntlm_buf\fP * session, struct \fBntlm_buf\fP * master)"
95 Generates an NTLMv2 session random with associated session master key.
99 \fIkey\fP the NTLMv2 key
101 \fIlen\fP length of key
103 \fIblob\fP the NTLMv2 'blob'
105 \fIsession\fP generated session nonce, should be freed with \fBheim_ntlm_free_buf()\fP.
107 \fImaster\fP calculated session master key, should be freed with \fBheim_ntlm_free_buf()\fP.
112 In case of success 0 is return, an errors, a errno in what went wrong.
116 .SS "int heim_ntlm_calculate_lm2 (const void * key, size_t len, const char * username, const char * target, const unsigned char serverchallenge[8], unsigned char ntlmv2[16], struct \fBntlm_buf\fP * answer)"
118 Calculate LMv2 response
122 \fIkey\fP the ntlm key
124 \fIlen\fP length of key
126 \fIusername\fP name of the user, as sent in the message, assumed to be in UTF8.
128 \fItarget\fP the name of the target, assumed to be in UTF8.
130 \fIserverchallenge\fP challenge as sent by the server in the type2 message.
132 \fIntlmv2\fP calculated session key
134 \fIanswer\fP ntlm response answer, should be freed with \fBheim_ntlm_free_buf()\fP.
139 In case of success 0 is return, an errors, a errno in what went wrong.
143 .SS "int heim_ntlm_calculate_ntlm1 (void * key, size_t len, unsigned char challenge[8], struct \fBntlm_buf\fP * answer)"
145 Calculate NTLMv1 response hash
149 \fIkey\fP the ntlm v1 key
151 \fIlen\fP length of key
153 \fIchallenge\fP sent by the server
155 \fIanswer\fP calculated answer, should be freed with \fBheim_ntlm_free_buf()\fP.
160 In case of success 0 is return, an errors, a errno in what went wrong.
164 .SS "int heim_ntlm_calculate_ntlm2 (const void * key, size_t len, const char * username, const char * target, const unsigned char serverchallenge[8], const struct \fBntlm_buf\fP * infotarget, unsigned char ntlmv2[16], struct \fBntlm_buf\fP * answer)"
166 Calculate NTLMv2 response
170 \fIkey\fP the ntlm key
172 \fIlen\fP length of key
174 \fIusername\fP name of the user, as sent in the message, assumed to be in UTF8.
176 \fItarget\fP the name of the target, assumed to be in UTF8.
178 \fIserverchallenge\fP challenge as sent by the server in the type2 message.
180 \fIinfotarget\fP infotarget as sent by the server in the type2 message.
182 \fIntlmv2\fP calculated session key
184 \fIanswer\fP ntlm response answer, should be freed with \fBheim_ntlm_free_buf()\fP.
189 In case of success 0 is return, an errors, a errno in what went wrong.
193 .SS "int heim_ntlm_decode_targetinfo (const struct \fBntlm_buf\fP * data, int ucs2, struct ntlm_targetinfo * ti)"
195 Decodes an NTLM targetinfo message
199 \fIdata\fP input data buffer with the encode NTLM targetinfo message
201 \fIucs2\fP if the strings should be encoded with ucs2 (selected by flag in message).
203 \fIti\fP the decoded target info, should be freed with \fBheim_ntlm_free_targetinfo()\fP.
208 In case of success 0 is return, an errors, a errno in what went wrong.
212 .SS "int heim_ntlm_encode_targetinfo (const struct ntlm_targetinfo * ti, int ucs2, struct \fBntlm_buf\fP * data)"
214 Encodes a ntlm_targetinfo message.
218 \fIti\fP the ntlm_targetinfo message to encode.
222 \fIdata\fP is the return buffer with the encoded message, should be freed with \fBheim_ntlm_free_buf()\fP.
227 In case of success 0 is return, an errors, a errno in what went wrong.
231 .SS "int heim_ntlm_encode_type1 (const struct \fBntlm_type1\fP * type1, struct \fBntlm_buf\fP * data)"
233 Encodes an \fBntlm_type1\fP message.
237 \fItype1\fP the \fBntlm_type1\fP message to encode.
239 \fIdata\fP is the return buffer with the encoded message, should be freed with \fBheim_ntlm_free_buf()\fP.
244 In case of success 0 is return, an errors, a errno in what went wrong.
248 .SS "int heim_ntlm_encode_type2 (const struct \fBntlm_type2\fP * type2, struct \fBntlm_buf\fP * data)"
250 Encodes an \fBntlm_type2\fP message.
254 \fItype2\fP the \fBntlm_type2\fP message to encode.
256 \fIdata\fP is the return buffer with the encoded message, should be freed with \fBheim_ntlm_free_buf()\fP.
261 In case of success 0 is return, an errors, a errno in what went wrong.
265 .SS "int heim_ntlm_encode_type3 (const struct \fBntlm_type3\fP * type3, struct \fBntlm_buf\fP * data)"
267 Encodes an \fBntlm_type3\fP message.
271 \fItype3\fP the \fBntlm_type3\fP message to encode.
273 \fIdata\fP is the return buffer with the encoded message, should be freed with \fBheim_ntlm_free_buf()\fP.
278 In case of success 0 is return, an errors, a errno in what went wrong.
282 .SS "void heim_ntlm_free_buf (struct \fBntlm_buf\fP * p)"
284 heim_ntlm_free_buf frees the ntlm buffer
288 \fIp\fP buffer to be freed
292 .SS "void heim_ntlm_free_targetinfo (struct ntlm_targetinfo * ti)"
294 Frees the ntlm_targetinfo message
298 \fIti\fP targetinfo to be freed
302 .SS "void heim_ntlm_free_type1 (struct \fBntlm_type1\fP * data)"
304 Frees the \fBntlm_type1\fP message
308 \fIdata\fP message to be freed
312 .SS "void heim_ntlm_free_type2 (struct \fBntlm_type2\fP * data)"
314 Frees the \fBntlm_type2\fP message
318 \fIdata\fP message to be freed
322 .SS "void heim_ntlm_free_type3 (struct \fBntlm_type3\fP * data)"
324 Frees the \fBntlm_type3\fP message
328 \fIdata\fP message to be freed
332 .SS "int heim_ntlm_keyex_unwrap (struct \fBntlm_buf\fP * baseKey, struct \fBntlm_buf\fP * encryptedSession, struct \fBntlm_buf\fP * session)"
334 Given a key and encrypted session, unwrap the session key
338 \fIbaseKey\fP the sessionBaseKey
340 \fIencryptedSession\fP encrypted session, type3.session field.
342 \fIsession\fP generated session nonce, should be freed with \fBheim_ntlm_free_buf()\fP.
347 In case of success 0 is return, an errors, a errno in what went wrong.
351 .SS "int heim_ntlm_nt_key (const char * password, struct \fBntlm_buf\fP * key)"
353 Calculate the NTLM key, the password is assumed to be in UTF8.
357 \fIpassword\fP password to calcute the key for.
359 \fIkey\fP calcuted key, should be freed with \fBheim_ntlm_free_buf()\fP.
364 In case of success 0 is return, an errors, a errno in what went wrong.
368 .SS "int heim_ntlm_ntlmv2_key (const void * key, size_t len, const char * username, const char * target, unsigned char ntlmv2[16])"
370 Generates an NTLMv2 session key.
374 \fIkey\fP the ntlm key
376 \fIlen\fP length of key
378 \fIusername\fP name of the user, as sent in the message, assumed to be in UTF8.
380 \fItarget\fP the name of the target, assumed to be in UTF8.
382 \fIntlmv2\fP the ntlmv2 session key
387 0 on success, or an error code on failure.
391 .SS "int heim_ntlm_verify_ntlm2 (const void * key, size_t len, const char * username, const char * target, time_t now, const unsigned char serverchallenge[8], const struct \fBntlm_buf\fP * answer, struct \fBntlm_buf\fP * infotarget, unsigned char ntlmv2[16])"
393 Verify NTLMv2 response.
397 \fIkey\fP the ntlm key
399 \fIlen\fP length of key
401 \fIusername\fP name of the user, as sent in the message, assumed to be in UTF8.
403 \fItarget\fP the name of the target, assumed to be in UTF8.
405 \fInow\fP the time now (0 if the library should pick it up itself)
407 \fIserverchallenge\fP challenge as sent by the server in the type2 message.
409 \fIanswer\fP ntlm response answer, should be freed with \fBheim_ntlm_free_buf()\fP.
411 \fIinfotarget\fP infotarget as sent by the server in the type2 message.
413 \fIntlmv2\fP calculated session key
418 In case of success 0 is return, an errors, a errno in what went wrong.