FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
smartcard_cli.c
1
20#include <winpr/assert.h>
21
22#include <freerdp/client/utils/smartcard_cli.h>
23#include <freerdp/utils/smartcardlogon.h>
24
25BOOL freerdp_smartcard_list(const rdpSettings* settings)
26{
27 SmartcardCertInfo** certs = NULL;
28 size_t count = 0;
29
30 if (!smartcard_enumerateCerts(settings, &certs, &count, FALSE))
31 return FALSE;
32
33 printf("smartcard reader detected, listing %" PRIuz " certificates:\n", count);
34 for (size_t i = 0; i < count; i++)
35 {
36 const SmartcardCertInfo* info = certs[i];
37 char asciiStr[256] = { 0 };
38
39 WINPR_ASSERT(info);
40
41 printf("%" PRIuz ": %s\n", i, info->subject);
42
43 if (ConvertWCharToUtf8(info->csp, asciiStr, ARRAYSIZE(asciiStr)))
44 printf("\t* CSP: %s\n", asciiStr);
45
46 if (ConvertWCharToUtf8(info->reader, asciiStr, ARRAYSIZE(asciiStr)))
47 printf("\t* reader: %s\n", asciiStr);
48#ifndef _WIN32
49 printf("\t* slotId: %" PRIu32 "\n", info->slotId);
50 printf("\t* pkinitArgs: %s\n", info->pkinitArgs);
51#endif
52 if (ConvertWCharToUtf8(info->containerName, asciiStr, ARRAYSIZE(asciiStr)))
53 printf("\t* containerName: %s\n", asciiStr);
54 if (info->upn)
55 printf("\t* UPN: %s\n", info->upn);
56 }
57 smartcardCertList_Free(certs, count);
58
59 return TRUE;
60}