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