Remote Call Framework 3.3
SspiCredentials.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2022, Delta V Software. All rights reserved.
6 // https://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF under GPL terms.
12 //
13 // Version: 3.3
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_SSPICREDENTIALS_HPP
19 #define INCLUDE_RCF_SSPICREDENTIALS_HPP
20 
21 #include <RCF/Enums.hpp>
22 #include <RCF/Tchar.hpp>
23 
24 #ifndef SECURITY_WIN32
25 #define SECURITY_WIN32
26 #endif
27 
28 #include <windows.h>
29 #include <security.h>
30 #include <WinCrypt.h>
31 #include <tchar.h>
32 
33 #ifdef _UNICODE
34 
35 #define INIT_SEC_INTERFACE_NAME "InitSecurityInterfaceW"
36 typedef unsigned short UTCHAR;
37 
38 #else
39 
40 #define INIT_SEC_INTERFACE_NAME "InitSecurityInterfaceA"
41 typedef unsigned char UTCHAR;
42 
43 #endif
44 
45 namespace RCF {
46 
47  class SspiCredentials;
48  typedef std::shared_ptr<SspiCredentials> SspiCredentialsPtr;
49 
50  class SspiCredentials
51  {
52  public:
53 
54  // For Kerberos/NTLM.
55  SspiCredentials(
56  SspiRole sspiRole,
57  const tstring& packageName,
58  const tstring& packageList,
59  const tstring &userName = RCF_T(""),
60  const tstring &password = RCF_T(""));
61 
62  // For Schannel.
63  SspiCredentials(
64  SspiRole sspiRole,
65  bool enableManualCertValidation,
66  DWORD enabledProtocols,
67  CertificatePtr localCertPtr);
68 
69  ~SspiCredentials();
70 
71  CredHandle mCredentials;
72  SecPkgInfo * mpPkgInfo = NULL;
73  SspiRole mSspiRole = Sr_Client;
74  bool mEnableManualCertValidation = false;
75  DWORD mEnabledProtocols = 0;
76  Win32CertificatePtr mLocalCertPtr;
77 
78  tstring mUserName;
79  const tstring mPackageName;
80  const tstring mPackageList;
81 
82  private:
83 
84  void setupCredentials(
85  const tstring &userName,
86  const tstring &password,
87  const tstring &domain);
88 
89  void setupCredentialsSchannel();
90 
91  void freeCredentials();
92 
93  void setupPkgInfo();
94 
95 
96  };
97 
98 } // namespace RCF
99 
100 #endif // ! INCLUDE_RCF_SSPICREDENTIALS_HPP
101 
std::shared_ptr< Win32Certificate > Win32CertificatePtr
Reference counted wrapper for RCF::Win32Certificate.
Definition: RcfFwd.hpp:257
Definition: AmiIoHandler.hpp:23