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