FreeRDP
Loading...
Searching...
No Matches
smartcard_virtual_gids.h
1
21#ifndef WINPR_SMARTCARD_VIRTUAL_GIDS_H
22#define WINPR_SMARTCARD_VIRTUAL_GIDS_H
23
24#include <winpr/winpr.h>
25#include <winpr/wtypes.h>
26#include <winpr/collections.h>
27
28#include <freerdp/api.h>
29#include <freerdp/channels/log.h>
30#include "smartcard_emulate.h"
31
32/* Virtual GIDS context */
33typedef struct vgids_context vgidsContext;
34
35/* frees a previously created virtual gids context */
36FREERDP_LOCAL
37void vgids_free(vgidsContext* context);
38
39/* Creates a new virtual gids context */
40WINPR_ATTR_MALLOC(vgids_free, 1)
41FREERDP_LOCAL vgidsContext* vgids_new(SmartcardEmulationContext* context);
42
43/*
44 Initializes the virtual gids context.
45 cert: PEM encoded smartcard certificate
46 privateKey: PEM encoded private key for the smartcard certificate
47 pin: Pin protecting the usage of the private key
48 Returns: TRUE on success, FALSE in case of an error
49*/
50WINPR_ATTR_NODISCARD
51FREERDP_LOCAL
52BOOL vgids_init(vgidsContext* ctx, const char* cert, const char* privateKey, const char* pin);
53
54/*
55 Processes the provided APDU returning a response for each processed command.
56 data: APDU byte stream
57 dataSize: size of the APDU provided in data
58 response: Pointer where the response buffer is stored to. Must be freed by caller!
59 responseSize: Size of the returned data buffer
60 Returns: TRUE on success, FALSE in case of an error
61*/
62WINPR_ATTR_NODISCARD
63FREERDP_LOCAL
64BOOL vgids_process_apdu(vgidsContext* context, const BYTE* data, DWORD dataSize, BYTE** response,
65 DWORD* responseSize);
66
67#endif /* WINPR_SMARTCARD_VIRTUAL_GIDS_H */