20 #ifndef WINPR_INCLUDE_WINPR_NCRYPT_H_
21 #define WINPR_INCLUDE_WINPR_NCRYPT_H_
28 #include <winpr/wtypes.h>
29 #include <winpr/winpr.h>
31 WINPR_PRAGMA_DIAG_PUSH
32 WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
34 #ifndef __SECSTATUS_DEFINED__
35 typedef LONG SECURITY_STATUS;
36 #define __SECSTATUS_DEFINED__
41 typedef ULONG_PTR NCRYPT_HANDLE;
42 typedef ULONG_PTR NCRYPT_PROV_HANDLE;
43 typedef ULONG_PTR NCRYPT_KEY_HANDLE;
45 #define MS_KEY_STORAGE_PROVIDER \
46 (const WCHAR*)"M\x00i\x00" \
47 "c\x00r\x00o\x00s\x00o\x00" \
54 "\x00S\x00t\x00o\x00r\x00" \
57 "\x00P\x00r\x00o\x00v\x00i\x00" \
60 #define MS_SMART_CARD_KEY_STORAGE_PROVIDER \
61 (const WCHAR*)"M\x00i\x00" \
62 "c\x00r\x00o\x00s\x00o\x00" \
63 "f\x00t\x00 \x00S\x00m\x00" \
70 "\x00S\x00t\x00o\x00r\x00" \
73 "\x00P\x00r\x00o\x00v\x00i\x00" \
77 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Crypto Provider"
78 #define MS_SCARD_PROV \
79 (const WCHAR*)("M\x00i\x00" \
80 "c\x00r\x00o\x00s\x00o\x00" \
86 "a\x00r\x00t\x00 \x00" \
91 "C\x00r\x00y\x00p\x00t\x00o\x00 " \
92 "\x00P\x00r\x00o\x00v\x00i\x00" \
96 #define MS_PLATFORM_KEY_STORAGE_PROVIDER \
97 (const WCHAR*)"M\x00i\x00" \
98 "c\x00r\x00o\x00s\x00o\x00" \
102 "f\x00o\x00r\x00m\x00 " \
104 "C\x00r\x00y\x00p\x00t\x00o\x00 " \
105 "\x00P\x00r\x00o\x00v\x00i\x00" \
109 #define NCRYPT_CERTIFICATE_PROPERTY \
110 (const WCHAR*)"S\x00m\x00" \
123 #define NCRYPT_NAME_PROPERTY (const WCHAR*)"N\x00a\x00m\x00e\x00\x00"
124 #define NCRYPT_UNIQUE_NAME_PROPERTY \
125 (const WCHAR*)"U\x00n\x00i\x00q\x00u\x00" \
129 #define NCRYPT_READER_PROPERTY \
130 (const WCHAR*)"S\x00m\x00" \
141 #define NCRYPT_WINPR_SLOTID (const WCHAR*)"S\x00l\x00o\x00t\x00\x00"
143 #define NCRYPT_MACHINE_KEY_FLAG 0x20
144 #define NCRYPT_SILENT_FLAG 0x40
151 DWORD dwLegacyKeySpec;
167 WINPR_API SECURITY_STATUS NCryptEnumStorageProviders(DWORD* wProviderCount,
171 WINPR_API SECURITY_STATUS NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE* phProvider,
172 LPCWSTR pszProviderName, DWORD dwFlags);
174 WINPR_API SECURITY_STATUS NCryptEnumKeys(NCRYPT_PROV_HANDLE hProvider, LPCWSTR pszScope,
178 WINPR_API SECURITY_STATUS NCryptOpenKey(NCRYPT_PROV_HANDLE hProvider, NCRYPT_KEY_HANDLE* phKey,
179 LPCWSTR pszKeyName, DWORD dwLegacyKeySpec,
182 WINPR_API SECURITY_STATUS NCryptGetProperty(NCRYPT_HANDLE hObject, LPCWSTR pszProperty,
183 PBYTE pbOutput, DWORD cbOutput, DWORD* pcbResult,
186 WINPR_API SECURITY_STATUS NCryptFreeObject(NCRYPT_HANDLE hObject);
187 WINPR_API SECURITY_STATUS NCryptFreeBuffer(PVOID pvInput);
208 WINPR_API SECURITY_STATUS winpr_NCryptOpenStorageProviderEx(NCRYPT_PROV_HANDLE* phProvider,
209 LPCWSTR pszProviderName,
210 DWORD dwFlags, LPCSTR* modulePaths);
218 WINPR_API
const char* winpr_NCryptSecurityStatusError(SECURITY_STATUS status);
227 WINPR_API
const char* winpr_NCryptGetModulePath(NCRYPT_PROV_HANDLE phProvider);
a provider name descriptor