github.com/lianghucheng/zrddz@v0.0.0-20200923083010-c71f680932e2/src/gopkg.in/mgo.v2/internal/sasl/sspi_windows.h (about) 1 // Code adapted from the NodeJS kerberos library: 2 // 3 // https://github.com/christkv/kerberos/tree/master/lib/win32/kerberos_sspi.h 4 // 5 // Under the terms of the Apache License, Version 2.0: 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 #ifndef SSPI_WINDOWS_H 10 #define SSPI_WINDOWS_H 11 12 #define SECURITY_WIN32 1 13 14 #include <windows.h> 15 #include <sspi.h> 16 17 int load_secur32_dll(); 18 19 SECURITY_STATUS SEC_ENTRY call_sspi_encrypt_message(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo); 20 21 typedef DWORD (WINAPI *encryptMessage_fn)(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo); 22 23 SECURITY_STATUS SEC_ENTRY call_sspi_acquire_credentials_handle( 24 LPSTR pszPrincipal, // Name of principal 25 LPSTR pszPackage, // Name of package 26 unsigned long fCredentialUse, // Flags indicating use 27 void *pvLogonId, // Pointer to logon ID 28 void *pAuthData, // Package specific data 29 SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func 30 void *pvGetKeyArgument, // Value to pass to GetKey() 31 PCredHandle phCredential, // (out) Cred Handle 32 PTimeStamp ptsExpiry // (out) Lifetime (optional) 33 ); 34 35 typedef DWORD (WINAPI *acquireCredentialsHandle_fn)( 36 LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse, 37 void *pvLogonId, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, 38 PCredHandle phCredential, PTimeStamp ptsExpiry 39 ); 40 41 SECURITY_STATUS SEC_ENTRY call_sspi_initialize_security_context( 42 PCredHandle phCredential, // Cred to base context 43 PCtxtHandle phContext, // Existing context (OPT) 44 LPSTR pszTargetName, // Name of target 45 unsigned long fContextReq, // Context Requirements 46 unsigned long Reserved1, // Reserved, MBZ 47 unsigned long TargetDataRep, // Data rep of target 48 PSecBufferDesc pInput, // Input Buffers 49 unsigned long Reserved2, // Reserved, MBZ 50 PCtxtHandle phNewContext, // (out) New Context handle 51 PSecBufferDesc pOutput, // (inout) Output Buffers 52 unsigned long *pfContextAttr, // (out) Context attrs 53 PTimeStamp ptsExpiry // (out) Life span (OPT) 54 ); 55 56 typedef DWORD (WINAPI *initializeSecurityContext_fn)( 57 PCredHandle phCredential, PCtxtHandle phContext, LPSTR pszTargetName, unsigned long fContextReq, 58 unsigned long Reserved1, unsigned long TargetDataRep, PSecBufferDesc pInput, unsigned long Reserved2, 59 PCtxtHandle phNewContext, PSecBufferDesc pOutput, unsigned long *pfContextAttr, PTimeStamp ptsExpiry); 60 61 SECURITY_STATUS SEC_ENTRY call_sspi_query_context_attributes( 62 PCtxtHandle phContext, // Context to query 63 unsigned long ulAttribute, // Attribute to query 64 void *pBuffer // Buffer for attributes 65 ); 66 67 typedef DWORD (WINAPI *queryContextAttributes_fn)( 68 PCtxtHandle phContext, unsigned long ulAttribute, void *pBuffer); 69 70 #endif // SSPI_WINDOWS_H