/[winpt]/trunk/Include/wptCardEdit.h
ViewVC logotype

Contents of /trunk/Include/wptCardEdit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (show annotations)
Fri Sep 30 10:10:16 2005 UTC (19 years, 5 months ago) by twoaday
File MIME type: text/plain
File size: 2644 byte(s)
Almost finished phase 1 of the WinPT GPGME port.
Still need more cleanup, comments and tests.


1 #ifndef WPT_CARDEDIT_H
2 #define WPT_CARDEDIT_H 1
3
4 /* All valid card commands. */
5 enum {
6 GPG_EDITCARD_NAME = 1,
7 GPG_EDITCARD_NAME2 = 2,
8 GPG_EDITCARD_KEYURL = 3,
9 GPG_EDITCARD_LOGIN = 4,
10 GPG_EDITCARD_SEX = 5,
11 GPG_EDITCARD_LANG = 6,
12 GPG_EDITCARD_APIN = 7,
13 GPG_EDITCARD_UPIN = 8,
14 GPG_EDITCARD_GENKEY = 9,
15 GPG_EDITCARD_FETCH = 10,
16 GPG_EDITCARD_CAFPR = 11,
17 GPG_EDITCARD_LIST = 12,
18
19 GPG_EDITCARD_CHPIN_ID = 20,
20 /* change pin */
21 GPG_EDITCARD_CHAPIN = 21,
22 GPG_EDITCARD_CHUPIN = 22,
23 GPG_EDITCARD_UNBPIN = 23 /*unblock PIN*/
24 };
25
26 struct gpg_card_s {
27 char *aid;
28 char *version;
29 char ver[6];
30 char *vendor;
31 char *serial;
32 char *surname;
33 char *givenname;
34 char *lang;
35 char sex;
36 char *url;
37 char *login;
38 int force_pin;
39 char *maxpinlen[3];
40 int sig_count;
41 char *fpr[3];
42 };
43 typedef struct gpg_card_s *gpg_card_t;
44
45 class GpgCardEdit {
46 public:
47 GpgCardEdit (void);
48 ~GpgCardEdit (void);
49
50 public:
51 void setPIN (const char *pin);
52 void setAdminPIN (const char *admin_pin);
53 void setNewPIN (const char *new_pin);
54 void setKeygenPassphrase (const char *pass);
55 void setCallback (const char* (*cb)(int code, void *opaque), void *cb_value);
56 void setType (int type);
57
58 gpgme_error_t getCardStatus (gpg_card_t *r_card);
59 gpgme_error_t genKey (int flags, const char *name,
60 const char *email, const char *comment,
61 long valid);
62 gpgme_error_t changePIN (void);
63
64 gpgme_error_t updateName (const char *given, const char *sur);
65 gpgme_error_t updateURL (const char *url);
66 gpgme_error_t updateLogin (const char *login);
67 gpgme_error_t updateLanguage (const char *lang);
68 gpgme_error_t updateSex (char sex);
69
70 gpgme_error_t doCmd (int cmd, const char *arg1, const char *arg2);
71
72 gpgme_error_t fetchKey (void);
73
74 public: /* XXX */
75 gpgme_ctx_t ctx;
76 const char *pin;
77 const char *pin_new;
78 const char *admin_pin;
79
80 int type;
81 int cnt;
82 int cancel;
83
84 struct {
85 const char *surname;
86 const char *givenname;
87 const char *keyurl;
88 const char *login;
89 const char *lang;
90 char sex;
91 } edit;
92
93 struct {
94 char *name;
95 char *email;
96 char *comment;
97 char *expdate;
98 int flags;
99 const char *pass;
100 } keygen;
101
102 const char *(*card_cb) (int code, void * opaque);
103 void * cb_value;
104 };
105
106
107 void gpg_card_release (gpg_card_t card);
108 gpgme_error_t gpg_card_edit (gpgme_ctx_t ctx, GpgCardEdit *ce);
109 gpg_card_t gpg_load_scard (void);
110
111 #endif

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26