Advertisement
MagicAndre1981

new NCrypt functions in #Windows10

Apr 4th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. #define NCRYPT_KEY_PROTECTION_ALGORITHM_LOCKEDCREDENTIALS L"LOCKEDCREDENTIALS"
  2. //
  3. // LOCKEDCREDENTIALS=%ProtectionDomain%[,%EnterpriseID%]
  4. //
  5.  
  6.  
  7. /****************************************************************************
  8. PFNCryptStreamOutputCallbackEx
  9.  
  10. pvCallbackCtxt
  11. The arguments specified by NCRYPT_PROTECT_STREAM_INFO_EX.
  12.  
  13. pbData
  14. A pointer to a block of processed data that is available to the application. If
  15. data is not available yet, but the descriptor is, this will be NULL.
  16.  
  17. cbData
  18. The size, in bytes, of the block of processed data at pbData.
  19.  
  20. hDescriptor
  21. Handle of Protection Descriptor.
  22.  
  23. fFinal
  24. Specifies that the last block of data is being processed and that this
  25. is the last time the callback will be executed.
  26.  
  27. Return Value
  28. Returns a status code that indicates the success or failure of the function.
  29. Possible return codes include, but are not limited to, the following.
  30.  
  31. ERROR_SUCCESS
  32. NTE_INVALID_PARAMETER
  33. NTE_BAD_FLAGS
  34. NTE_BAD_DATA
  35. NTE_NO_MEMORY
  36. NTE_NOT_FOUND
  37. NTE_NOT_SUPPORTED
  38. NTE_INVALID_HANDLE
  39. NTE_BAD_KEY
  40. NTE_BAD_PROVIDER
  41. NTE_BAD_TYPE
  42.  
  43. ****************************************************************************/
  44. typedef
  45. SECURITY_STATUS
  46. (WINAPI *PFNCryptStreamOutputCallbackEx)(
  47. _In_ void *pvCallbackCtxt,
  48. _In_reads_bytes_opt_(cbData)
  49. const BYTE *pbData,
  50. SIZE_T cbData,
  51. _In_ NCRYPT_DESCRIPTOR_HANDLE hDescriptor,
  52. BOOL fFinal
  53. );
  54.  
  55. /****************************************************************************
  56. NCRYPT_PROTECT_STREAM_INFO_EX
  57.  
  58. The NCRYPT_PROTECT_STREAM_INFO_EX structure is used to enable stream processing
  59. of data rather than single block processing.
  60. This structure is passed to the NCryptStreamOpenToUnprotectEx function. There
  61. is not equivalent NCryptStreamOpenToProtectEx function, thus you need to use
  62. the PFNCryptStreamOutputCallback, NCRYPT_PROTECT_STREAM_INFO and
  63. NCryptStreamOpenToProtect functions.
  64.  
  65. pfnStreamOutput
  66. [in] The address of a callback function used to read from and write
  67. data to a disk when processing large messages.
  68.  
  69. pvCallbackCtxt
  70. [in] A pointer to the argument to pass to the callback function.
  71.  
  72. ****************************************************************************/
  73. typedef struct NCRYPT_PROTECT_STREAM_INFO_EX {
  74. PFNCryptStreamOutputCallbackEx pfnStreamOutput;
  75. void *pvCallbackCtxt;
  76. } NCRYPT_PROTECT_STREAM_INFO_EX;
  77.  
  78. /****************************************************************************
  79. NCryptStreamOpenToUnprotectEx
  80.  
  81. pStreamInfo
  82. [in] A pointer to NCRYPT_PROTECT_STREAM_INFO_EX.
  83.  
  84. dwFlags
  85. The following flags are supported.
  86. NCRYPT_SILENT_FLAG
  87.  
  88. hWnd
  89. [in, optional] A window handle (HWND) to be used as the parent of any user
  90. interface that is displayed.
  91.  
  92. phStream
  93. [out] Receives a pointer to a stream handle.
  94.  
  95. Return Value
  96. Returns a status code that indicates the success or failure of the function.
  97. Possible return codes include, but are not limited to, the following.
  98.  
  99. ERROR_SUCCESS
  100. NTE_INVALID_PARAMETER
  101. NTE_BAD_FLAGS
  102. NTE_BAD_DATA
  103. NTE_NO_MEMORY
  104. NTE_NOT_FOUND
  105. NTE_NOT_SUPPORTED
  106. NTE_INVALID_HANDLE
  107. NTE_BAD_KEY
  108. NTE_BAD_PROVIDER
  109. NTE_BAD_TYPE
  110. NTE_DECRYPTION_FAILURE
  111.  
  112. ****************************************************************************/
  113. SECURITY_STATUS
  114. WINAPI
  115. NCryptStreamOpenToUnprotectEx(
  116. _In_ NCRYPT_PROTECT_STREAM_INFO_EX *pStreamInfo,
  117. DWORD dwFlags,
  118. _In_opt_ HWND hWnd,
  119. _Out_ NCRYPT_STREAM_HANDLE *phStream
  120. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement