20 #ifndef WINPR_LIBWINPR_NCRYPT_NCRYPT_H_
21 #define WINPR_LIBWINPR_NCRYPT_NCRYPT_H_
23 #include <winpr/config.h>
25 #include <winpr/bcrypt.h>
26 #include <winpr/crypto.h>
27 #include <winpr/ncrypt.h>
28 #include <winpr/error.h>
29 #include <winpr/string.h>
35 WINPR_NCRYPT_PROVIDER,
40 typedef SECURITY_STATUS (*NCryptReleaseFn)(NCRYPT_HANDLE handle);
45 NCRYPT_PROPERTY_CERTIFICATE,
46 NCRYPT_PROPERTY_READER,
47 NCRYPT_PROPERTY_SLOTID,
49 NCRYPT_PROPERTY_UNKNOWN
50 } NCryptKeyGetPropertyEnum;
52 typedef SECURITY_STATUS (*NCryptGetPropertyFn)(NCRYPT_HANDLE hObject,
53 NCryptKeyGetPropertyEnum property, PBYTE pbOutput,
54 DWORD cbOutput, DWORD* pcbResult, DWORD dwFlags);
60 NCryptHandleType type;
61 NCryptGetPropertyFn getPropertyFn;
62 NCryptReleaseFn releaseFn;
65 typedef SECURITY_STATUS (*NCryptEnumKeysFn)(NCRYPT_PROV_HANDLE hProvider, LPCWSTR pszScope,
68 typedef SECURITY_STATUS (*NCryptOpenKeyFn)(NCRYPT_PROV_HANDLE hProvider, NCRYPT_KEY_HANDLE* phKey,
69 LPCWSTR pszKeyName, DWORD dwLegacyKeySpec,
77 NCryptEnumKeysFn enumKeysFn;
78 NCryptOpenKeyFn openKeyFn;
81 SECURITY_STATUS checkNCryptHandle(NCRYPT_HANDLE handle, NCryptHandleType matchType);
83 SECURITY_STATUS winpr_NCryptDefault_dtor(NCRYPT_HANDLE handle);
85 void* ncrypt_new_handle(NCryptHandleType kind,
size_t len, NCryptGetPropertyFn getProp,
86 NCryptReleaseFn dtor);
88 #if defined(WITH_PKCS11)
89 SECURITY_STATUS NCryptOpenP11StorageProviderEx(NCRYPT_PROV_HANDLE* phProvider,
90 LPCWSTR pszProviderName, DWORD dwFlags,
93 const char* NCryptGetModulePath(NCRYPT_PROV_HANDLE phProvider);
common ncrypt handle items
common ncrypt provider items