2 * This is the actual card emulator.
4 * These functions can be implemented in different ways on different platforms
5 * using the underlying system primitives. For Linux it uses NSS, though direct
6 * to PKCS #11, openssl+pkcs11, or even gnu crypto libraries+pkcs #11 could be
7 * used. On Windows CAPI could be used.
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
14 #define VCARD_EMUL_H 1
16 #include "card_7816t.h"
18 #include "vcard_emul_type.h"
26 /* return values by vcard_emul_init */
27 VCARD_EMUL_INIT_ALREADY_INITED
,
30 /* options are emul specific. call card_emul_parse_args to change a string
31 * To an options struct */
32 typedef struct VCardEmulOptionsStruct VCardEmulOptions
;
37 /* return the number of login attempts still possible on the card. if unknown,
39 int vcard_emul_get_login_count(VCard
*card
);
40 /* login into the card, return the 7816 status word (sw2 || sw1) */
41 vcard_7816_status_t
vcard_emul_login(VCard
*card
, unsigned char *pin
,
48 void vcard_emul_delete_key(VCardKey
*key
);
49 /* RSA sign/decrypt with the key, signature happens 'in place' */
50 vcard_7816_status_t
vcard_emul_rsa_op(VCard
*card
, VCardKey
*key
,
51 unsigned char *buffer
, int buffer_size
);
53 void vcard_emul_reset(VCard
*card
, VCardPower power
);
54 void vcard_emul_get_atr(VCard
*card
, unsigned char *atr
, int *atr_len
);
56 /* Re-insert of a card that has been removed by force removal */
57 VCardEmulError
vcard_emul_force_card_insert(VReader
*vreader
);
58 /* Force a card removal even if the card is not physically removed */
59 VCardEmulError
vcard_emul_force_card_remove(VReader
*vreader
);
61 VCardEmulOptions
*vcard_emul_options(const char *args
);
62 VCardEmulError
vcard_emul_init(const VCardEmulOptions
*options
);
63 void vcard_emul_replay_insertion_events(void);
64 void vcard_emul_usage(void);