kerberos_sspi.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef SSPI_C_H
  2. #define SSPI_C_H
  3. #define SECURITY_WIN32 1
  4. #include <windows.h>
  5. #include <sspi.h>
  6. /**
  7. * Encrypt A Message
  8. */
  9. SECURITY_STATUS SEC_ENTRY _sspi_EncryptMessage(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo);
  10. typedef DWORD (WINAPI *encryptMessage_fn)(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo);
  11. /**
  12. * Acquire Credentials
  13. */
  14. SECURITY_STATUS SEC_ENTRY _sspi_AcquireCredentialsHandle(
  15. LPSTR pszPrincipal, // Name of principal
  16. LPSTR pszPackage, // Name of package
  17. unsigned long fCredentialUse, // Flags indicating use
  18. void * pvLogonId, // Pointer to logon ID
  19. void * pAuthData, // Package specific data
  20. SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func
  21. void * pvGetKeyArgument, // Value to pass to GetKey()
  22. PCredHandle phCredential, // (out) Cred Handle
  23. PTimeStamp ptsExpiry // (out) Lifetime (optional)
  24. );
  25. typedef DWORD (WINAPI *acquireCredentialsHandle_fn)(
  26. LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse,
  27. void * pvLogonId, void * pAuthData, SEC_GET_KEY_FN pGetKeyFn, void * pvGetKeyArgument,
  28. PCredHandle phCredential, PTimeStamp ptsExpiry
  29. );
  30. /**
  31. * Delete Security Context
  32. */
  33. SECURITY_STATUS SEC_ENTRY _sspi_DeleteSecurityContext(
  34. PCtxtHandle phContext // Context to delete
  35. );
  36. typedef DWORD (WINAPI *deleteSecurityContext_fn)(PCtxtHandle phContext);
  37. /**
  38. * Decrypt Message
  39. */
  40. SECURITY_STATUS SEC_ENTRY _sspi_DecryptMessage(
  41. PCtxtHandle phContext,
  42. PSecBufferDesc pMessage,
  43. unsigned long MessageSeqNo,
  44. unsigned long pfQOP
  45. );
  46. typedef DWORD (WINAPI *decryptMessage_fn)(
  47. PCtxtHandle phContext, PSecBufferDesc pMessage, unsigned long MessageSeqNo, unsigned long pfQOP);
  48. /**
  49. * Initialize Security Context
  50. */
  51. SECURITY_STATUS SEC_ENTRY _sspi_initializeSecurityContext(
  52. PCredHandle phCredential, // Cred to base context
  53. PCtxtHandle phContext, // Existing context (OPT)
  54. LPSTR pszTargetName, // Name of target
  55. unsigned long fContextReq, // Context Requirements
  56. unsigned long Reserved1, // Reserved, MBZ
  57. unsigned long TargetDataRep, // Data rep of target
  58. PSecBufferDesc pInput, // Input Buffers
  59. unsigned long Reserved2, // Reserved, MBZ
  60. PCtxtHandle phNewContext, // (out) New Context handle
  61. PSecBufferDesc pOutput, // (inout) Output Buffers
  62. unsigned long * pfContextAttr, // (out) Context attrs
  63. PTimeStamp ptsExpiry // (out) Life span (OPT)
  64. );
  65. typedef DWORD (WINAPI *initializeSecurityContext_fn)(
  66. PCredHandle phCredential, PCtxtHandle phContext, LPSTR pszTargetName, unsigned long fContextReq,
  67. unsigned long Reserved1, unsigned long TargetDataRep, PSecBufferDesc pInput, unsigned long Reserved2,
  68. PCtxtHandle phNewContext, PSecBufferDesc pOutput, unsigned long * pfContextAttr, PTimeStamp ptsExpiry);
  69. /**
  70. * Query Context Attributes
  71. */
  72. SECURITY_STATUS SEC_ENTRY _sspi_QueryContextAttributes(
  73. PCtxtHandle phContext, // Context to query
  74. unsigned long ulAttribute, // Attribute to query
  75. void * pBuffer // Buffer for attributes
  76. );
  77. typedef DWORD (WINAPI *queryContextAttributes_fn)(
  78. PCtxtHandle phContext, unsigned long ulAttribute, void * pBuffer);
  79. /**
  80. * InitSecurityInterface
  81. */
  82. PSecurityFunctionTable _ssip_InitSecurityInterface();
  83. typedef DWORD (WINAPI *initSecurityInterface_fn) ();
  84. /**
  85. * Load security.dll dynamically
  86. */
  87. int load_library();
  88. #endif