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

Annotation of /trunk/Include/wptCardEdit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (hide annotations)
Mon Oct 17 08:49:30 2005 UTC (19 years, 4 months ago) by twoaday
File MIME type: text/plain
File size: 3354 byte(s)
More bug fixes all over the place.
See ChangeLog for details.

1 twoaday 26 /* wptCardEdit.h
2     * Copyright (C) 2005 Timo Schulz
3     *
4     * This file is part of WinPT.
5     *
6     * WinPT is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * WinPT is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with WinPT; if not, write to the Free Software Foundation,
18     * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19     */
20 twoaday 23 #ifndef WPT_CARDEDIT_H
21     #define WPT_CARDEDIT_H 1
22    
23     /* All valid card commands. */
24     enum {
25     GPG_EDITCARD_NAME = 1,
26     GPG_EDITCARD_NAME2 = 2,
27     GPG_EDITCARD_KEYURL = 3,
28     GPG_EDITCARD_LOGIN = 4,
29     GPG_EDITCARD_SEX = 5,
30     GPG_EDITCARD_LANG = 6,
31     GPG_EDITCARD_APIN = 7,
32     GPG_EDITCARD_UPIN = 8,
33     GPG_EDITCARD_GENKEY = 9,
34     GPG_EDITCARD_FETCH = 10,
35     GPG_EDITCARD_CAFPR = 11,
36     GPG_EDITCARD_LIST = 12,
37    
38     GPG_EDITCARD_CHPIN_ID = 20,
39     /* change pin */
40     GPG_EDITCARD_CHAPIN = 21,
41     GPG_EDITCARD_CHUPIN = 22,
42     GPG_EDITCARD_UNBPIN = 23 /*unblock PIN*/
43     };
44    
45 twoaday 26 enum {
46     GPG_CARDRES_NOCARD = 1, /* no card in the reader */
47     GPG_CARDRES_BAD_PIN= 2
48 twoaday 23 };
49    
50 twoaday 26 /* gpg edit key abstraction class */
51 twoaday 23 class GpgCardEdit {
52 twoaday 26 private:
53     int result;
54    
55 twoaday 23 public:
56     GpgCardEdit (void);
57     ~GpgCardEdit (void);
58    
59     public:
60     void setPIN (const char *pin);
61     void setAdminPIN (const char *admin_pin);
62     void setNewPIN (const char *new_pin);
63     void setKeygenPassphrase (const char *pass);
64     void setCallback (const char* (*cb)(int code, void *opaque), void *cb_value);
65 twoaday 26 void setResult (int res);
66     int getResult (void);
67     void reset (void);
68 twoaday 23
69     gpgme_error_t getCardStatus (gpg_card_t *r_card);
70     gpgme_error_t genKey (int flags, const char *name,
71     const char *email, const char *comment,
72 twoaday 26 long valid, char **r_key_fpr);
73     gpgme_error_t changePIN (int type);
74 twoaday 23
75     gpgme_error_t updateName (const char *given, const char *sur);
76     gpgme_error_t updateURL (const char *url);
77     gpgme_error_t updateLogin (const char *login);
78     gpgme_error_t updateLanguage (const char *lang);
79     gpgme_error_t updateSex (char sex);
80    
81     gpgme_error_t doCmd (int cmd, const char *arg1, const char *arg2);
82    
83     gpgme_error_t fetchKey (void);
84    
85     public: /* XXX */
86     gpgme_ctx_t ctx;
87     const char *pin;
88     const char *pin_new;
89     const char *admin_pin;
90    
91     int type;
92     int cnt;
93     int cancel;
94    
95     struct {
96     const char *surname;
97     const char *givenname;
98     const char *keyurl;
99     const char *login;
100     const char *lang;
101     char sex;
102     } edit;
103    
104     struct {
105     char *name;
106     char *email;
107     char *comment;
108     char *expdate;
109     int flags;
110     const char *pass;
111 twoaday 26 char *key_fpr;
112 twoaday 23 } keygen;
113    
114     const char *(*card_cb) (int code, void * opaque);
115     void * cb_value;
116     };
117    
118    
119     void gpg_card_release (gpg_card_t card);
120     gpgme_error_t gpg_card_edit (gpgme_ctx_t ctx, GpgCardEdit *ce);
121 twoaday 26 gpg_card_t gpg_card_load (void);
122 twoaday 23
123     #endif

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26