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

Annotation of /trunk/Include/wptCardEdit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (hide annotations)
Thu Oct 20 12:35:59 2005 UTC (19 years, 4 months ago) by twoaday
File MIME type: text/plain
File size: 3574 byte(s)
Minor cleanups and prepare the translation.

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 twoaday 28 GPG_EDITCARD_CHAPIN = 21, /* admin */
41     GPG_EDITCARD_CHUPIN = 22, /* user */
42     GPG_EDITCARD_UNBPIN = 23 /* unblock PIN */
43 twoaday 23 };
44    
45 twoaday 27 /* Possible card results (can be ORed) */
46 twoaday 26 enum {
47     GPG_CARDRES_NOCARD = 1, /* no card in the reader */
48 twoaday 27 GPG_CARDRES_BAD_PIN= 2, /* wrong PIN entered */
49     GPG_CARDRES_CANCEL = 4 /* card was missing and user cancelled. */
50 twoaday 23 };
51    
52 twoaday 26 /* gpg edit key abstraction class */
53 twoaday 23 class GpgCardEdit {
54 twoaday 26 private:
55 twoaday 28 int type;
56 twoaday 26 int result;
57 twoaday 28 gpgme_ctx_t ctx;
58 twoaday 26
59 twoaday 23 public:
60     GpgCardEdit (void);
61     ~GpgCardEdit (void);
62    
63     public:
64     void setPIN (const char *pin);
65     void setAdminPIN (const char *admin_pin);
66     void setNewPIN (const char *new_pin);
67     void setKeygenPassphrase (const char *pass);
68     void setCallback (const char* (*cb)(int code, void *opaque), void *cb_value);
69 twoaday 26 void setResult (int res);
70     int getResult (void);
71     void reset (void);
72 twoaday 28 int getType ();
73 twoaday 23
74     gpgme_error_t getCardStatus (gpg_card_t *r_card);
75     gpgme_error_t genKey (int flags, const char *name,
76     const char *email, const char *comment,
77 twoaday 26 long valid, char **r_key_fpr);
78     gpgme_error_t changePIN (int type);
79 twoaday 23
80     gpgme_error_t updateName (const char *given, const char *sur);
81     gpgme_error_t updateURL (const char *url);
82     gpgme_error_t updateLogin (const char *login);
83     gpgme_error_t updateLanguage (const char *lang);
84     gpgme_error_t updateSex (char sex);
85    
86     gpgme_error_t doCmd (int cmd, const char *arg1, const char *arg2);
87    
88     gpgme_error_t fetchKey (void);
89    
90 twoaday 28 public: /* XXX hide the internals */
91 twoaday 23 const char *pin;
92     const char *pin_new;
93     const char *admin_pin;
94    
95     int cnt;
96     int cancel;
97    
98     struct {
99     const char *surname;
100     const char *givenname;
101     const char *keyurl;
102     const char *login;
103     const char *lang;
104     char sex;
105     } edit;
106    
107     struct {
108     char *name;
109     char *email;
110     char *comment;
111     char *expdate;
112     int flags;
113     const char *pass;
114 twoaday 26 char *key_fpr;
115 twoaday 23 } keygen;
116    
117     const char *(*card_cb) (int code, void * opaque);
118 twoaday 28 void *cb_value;
119 twoaday 23 };
120    
121    
122 twoaday 28 gpg_card_t gpg_card_load (void);
123     void gpg_card_release (gpg_card_t card);
124 twoaday 23 gpgme_error_t gpg_card_edit (gpgme_ctx_t ctx, GpgCardEdit *ce);
125    
126     #endif

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26