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

Contents of /trunk/Include/wptCardEdit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 37 - (show annotations)
Thu Oct 27 19:12:40 2005 UTC (19 years, 4 months ago) by werner
File MIME type: text/plain
File size: 3481 byte(s)
Added 2 dummy files, chnaged eol-style property

1 /* 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 #ifndef WPT_CARDEDIT_H
21 #define WPT_CARDEDIT_H 1
22
23 /* All valid card commands. */
24 enum gpg_editcard_cmd_t {
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, /* admin */
41 GPG_EDITCARD_CHUPIN = 22, /* user */
42 GPG_EDITCARD_UNBPIN = 23 /* unblock PIN */
43 };
44
45 /* Possible card results (can be ORed) */
46 enum card_result_t {
47 GPG_CARDRES_NOCARD = 1, /* no card in the reader */
48 GPG_CARDRES_BAD_PIN= 2, /* wrong PIN entered */
49 GPG_CARDRES_CANCEL = 4 /* card was missing and user cancelled. */
50 };
51
52 /* gpg edit key abstraction class */
53 class GpgCardEdit {
54 private:
55 int type;
56 int result;
57 gpgme_ctx_t ctx;
58
59 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 void setResult (int res);
70 int getResult (void);
71 void reset (void);
72 int getType ();
73
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 long valid, char **r_key_fpr);
78 gpgme_error_t changePIN (int type);
79
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 public: /* XXX hide the internals */
91 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 char *key_fpr;
115 } keygen;
116
117 const char *(*card_cb) (int code, void * opaque);
118 void *cb_value;
119 };
120
121
122 gpg_card_t gpg_card_load (void);
123 void gpg_card_release (gpg_card_t card);
124 gpgme_error_t gpg_card_edit (gpgme_ctx_t ctx, GpgCardEdit *ce);
125
126 #endif

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26