ntlm.h (2442B)
1/** 2 * WinPR: Windows Portable Runtime 3 * NTLM Utils 4 * 5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef WINPR_UTILS_NTLM_H 21#define WINPR_UTILS_NTLM_H 22 23#include <stdio.h> 24#include <stdlib.h> 25#include <string.h> 26#include <winpr/winpr.h> 27#include <winpr/wtypes.h> 28#include <winpr/sspi.h> 29 30#ifdef __cplusplus 31extern "C" 32{ 33#endif 34 35 typedef SECURITY_STATUS (*psPeerComputeNtlmHash)(void* client, 36 const SEC_WINNT_AUTH_IDENTITY* authIdentity, 37 const SecBuffer* ntproofvalue, 38 const BYTE* randkey, const BYTE* mic, 39 const SecBuffer* micvalue, BYTE* ntlmhash); 40 41 WINPR_API BOOL NTOWFv1W(LPWSTR Password, UINT32 PasswordLength, BYTE* NtHash); 42 WINPR_API BOOL NTOWFv1A(LPSTR Password, UINT32 PasswordLength, BYTE* NtHash); 43 44 WINPR_API BOOL NTOWFv2W(LPWSTR Password, UINT32 PasswordLength, LPWSTR User, UINT32 UserLength, 45 LPWSTR Domain, UINT32 DomainLength, BYTE* NtHash); 46 WINPR_API BOOL NTOWFv2A(LPSTR Password, UINT32 PasswordLength, LPSTR User, UINT32 UserLength, 47 LPSTR Domain, UINT32 DomainLength, BYTE* NtHash); 48 49 WINPR_API BOOL NTOWFv2FromHashW(BYTE* NtHashV1, LPWSTR User, UINT32 UserLength, LPWSTR Domain, 50 UINT32 DomainLength, BYTE* NtHash); 51 WINPR_API BOOL NTOWFv2FromHashA(BYTE* NtHashV1, LPSTR User, UINT32 UserLength, LPSTR Domain, 52 UINT32 DomainLength, BYTE* NtHash); 53 54#ifdef __cplusplus 55} 56#endif 57 58#ifdef UNICODE 59#define NTOWFv1 NTOWFv1W 60#define NTOWFv2 NTOWFv2W 61#define NTOWFv2FromHash NTOWFv2FromHashW 62#else 63#define NTOWFv1 NTOWFv1A 64#define NTOWFv2 NTOWFv2A 65#define NTOWFv2FromHash NTOWFv2FromHashA 66#endif 67 68#endif /* WINPR_UTILS_NTLM_H */