FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
TestNCryptProviders.c
1
19#include <winpr/error.h>
20#include <winpr/ncrypt.h>
21#include <winpr/string.h>
22#include <winpr/wlog.h>
23#include <winpr/smartcard.h>
24
25#define TAG "testNCrypt"
26
27int TestNCryptProviders(int argc, char* argv[])
28{
29 SECURITY_STATUS status = 0;
30 DWORD nproviders = 0;
31 NCryptProviderName* providers = NULL;
32
33 WINPR_UNUSED(argc);
34 WINPR_UNUSED(argv);
35
36 status = NCryptEnumStorageProviders(&nproviders, &providers, NCRYPT_SILENT_FLAG);
37 if (status != ERROR_SUCCESS)
38 return -1;
39
40 for (DWORD i = 0; i < nproviders; i++)
41 {
42 const NCryptProviderName* provider = &providers[i];
43 char providerNameStr[256] = { 0 };
44
45 (void)ConvertWCharToUtf8(provider->pszName, providerNameStr, ARRAYSIZE(providerNameStr));
46 printf("%d: %s\n", i, providerNameStr);
47 }
48
49 NCryptFreeBuffer(providers);
50 return 0;
51}
a provider name descriptor