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