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

Annotation of /trunk/Include/wptKeyEdit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 200 - (hide annotations)
Mon Apr 17 09:12:50 2006 UTC (18 years, 10 months ago) by twoaday
File MIME type: text/plain
File size: 5905 byte(s)
2006-04-16  Timo Schulz  <ts@g10code.de>
 
        * wptHTTP.cpp (getErrorCode): New.
        (connect): Store winsock error code.
        * wptGPGMEData.cpp (is_armor_header): New.
        * wptGPG.cpp (check_gnupg_engine): Free context.
        (gnupg_backup_keyrings): Do not use global vars.
        * wptGPGUtil.cpp (gpg_export_seckey): Export in ascii format.
         
2006-04-15  Timo Schulz  <ts@g10code.de>
 
        * wptKeyManager.cpp (km_get_key): New.
        (km_key_show_revoc_info): New.
        * wptKeyRevokeDlg.cpp (key_revoke_dlg): Cleanups.
        (on_init_dialog): New.
        * wptKeyManagerDlg.cpp (key_manager_dlg_proc): Factour
        out some common code and use km_get_key() instead.
        * wptKeyEditDlgs.cpp (do_init_keylist): Change second
        param type. Change all callers.
        * wptKeyEdit.cpp (addNotation): New.
        * wptKeyEditCB.cpp (editkey_command_handler): Remove 'step'
        param everywhere. Change all callers.


1 werner 37 /* wptKeyEdit.h
2     * Copyright (C) 2003, 2004 Timo Schulz
3     *
4     * This file is part of WinPT.
5     *
6     * WinPT is free software; you can redistribute it and/or
7     * modify it under the terms of the GNU General Public License
8     * as published by the Free Software Foundation; either version 2
9     * of the License, or (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 GNU
14     * 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    
21     #ifndef WPT_KEY_EDIT_H
22     #define WPT_KEY_EDIT_H
23    
24     /* IDs for all possible gpg edit key commands. */
25     enum gpg_editkey_t {
26     GPG_EDITKEY_SIGN = 1,
27     GPG_EDITKEY_LSIGN = 2,
28     GPG_EDITKEY_NRSIGN = 19,
29     GPG_EDITKEY_NRLSIGN = 22,
30     GPG_EDITKEY_TSIGN = 20,
31     GPG_EDITKEY_TRUST = 3,
32     GPG_EDITKEY_ADDUID = 4,
33     GPG_EDITKEY_DELUID = 5,
34     GPG_EDITKEY_DELKEY = 6,
35     GPG_EDITKEY_ADDKEY = 7,
36     GPG_EDITKEY_PASSWD = 8,
37     GPG_EDITKEY_PRIMARY = 9,
38     GPG_EDITKEY_EXPIRE = 10,
39     GPG_EDITKEY_REVSIG = 11,
40     GPG_EDITKEY_REVKEY = 12,
41     GPG_EDITKEY_REVOKE = 13, /* revoke the whole key */
42     GPG_EDITKEY_ADDREV = 14,
43     GPG_EDITKEY_ADDPHOTO= 15,
44     GPG_EDITKEY_ENABLE = 16,
45     GPG_EDITKEY_DISABLE = 17,
46     GPG_EDITKEY_SETPREF = 18,
47     GPG_EDITKEY_DELSIG = 21,
48     GPG_EDITKEY_KEYSERV = 23,
49 twoaday 119 GPG_EDITKEY_REVUID = 24,
50 twoaday 200 GPG_EDITKEY_CLEAN = 25,
51     GPG_EDITKEY_NOTATION= 26
52 werner 37 };
53    
54     /* Reasons for revocations. */
55     enum gpg_revoke_t {
56     GPG_REVOKE_INSECURE = 1,
57     GPG_REVOKE_SUPERSEDED = 2,
58     GPG_REVOKE_NOUSED = 3
59     };
60    
61     /* Contain information about designated revokers. */
62     struct gpg_desig_rev_s {
63     struct gpg_desig_rev_s *next;
64     gpgme_pubkey_algo_t pubkey_algo;
65     char fpr[41];
66     };
67     typedef struct gpg_desig_rev_s *gpg_desig_rev_t;
68    
69     /* Context to hold all user-ID information. */
70     struct gpg_user_id_info_s {
71     struct gpg_user_id_info_s *next;
72     struct {
73     unsigned int revoked:1;
74     unsigned int invalid:1;
75     unsigned int primary:1;
76     unsigned int mdc:1;
77     unsigned int no_ks_modify:1;
78     } flags;
79     int validity;
80     char *name;
81     char *email;
82     char *prefs;
83     int index;
84     };
85     typedef struct gpg_user_id_info_s *gpg_uid_info_t;
86    
87     /* Class to abstract the gpg edit key interface. */
88     class GpgKeyEdit {
89     private:
90     gpgme_key_t key;
91     gpgme_ctx_t ctx;
92     int resval;
93     int type;
94    
95 twoaday 176 bool key_has_passwd;
96    
97 twoaday 170 int sig_index;
98     int key_index;
99     int uid_index;
100    
101 twoaday 176 int valid;
102    
103 werner 37 public:
104     int cnt;
105     int cmd_sent;
106     const char *pass;
107     const char *new_pass;
108     const char *url;
109     int trust_id;
110 twoaday 200 char *notation;
111 werner 37 char *name, *cmt, *email;
112     const char *exp_date; /* XXX */
113     gpgme_pubkey_algo_t pubkey_algo;
114 twoaday 200 unsigned int pubkey_size;
115 werner 37 int flags;
116     int sig_class;
117     int reason;
118    
119     public:
120     GpgKeyEdit (gpgme_key_t key);
121     GpgKeyEdit (const char *keyid);
122     ~GpgKeyEdit (void);
123    
124     bool isValid (void);
125     void reset (void);
126 twoaday 175
127 twoaday 170 void clear (void);
128 twoaday 175 void clearPassphrase (void);
129 werner 37
130 twoaday 176 void setNoPassphrase (bool val);
131 werner 37 void setPassphrase (const char *pass);
132     void setKey (gpgme_key_t key);
133     void setKeyID (const char *keyid);
134     void setLocalUser (gpgme_key_t locusr);
135 twoaday 170 void setCallback (gpgme_progress_cb_t cb, void *cb_value);
136 werner 37 void setResult (int val);
137     int getResult (void);
138    
139 twoaday 170 gpgme_key_t getKey (void);
140     int getType (void);
141     int getUseridIndex (void);
142     int getKeyIndex (void);
143     int getSigIndex (void);
144 twoaday 176 int getValidDays (void);
145 twoaday 170
146 twoaday 200 gpgme_error_t addNotation (int uid_idx, const char *notation);
147 twoaday 170 gpgme_error_t signUserid (int uid_idx, int mode, int sig_class,
148     const char *exp_date);
149 werner 37 gpgme_error_t signKey (int mode, int sig_class, const char *exp_date);
150     gpgme_error_t setTrust (gpgme_validity_t trust);
151     gpgme_error_t addUserid (const char *name, const char *cmt,
152     const char *email);
153     gpgme_error_t delUserid (int index);
154     gpgme_error_t delKey (int index);
155     gpgme_error_t addSubkey (gpgme_pubkey_algo_t pubkey_algo,
156     unsigned int nbits, long valid);
157     gpgme_error_t changePassphrase (const char *new_pass, int allow_empty);
158     gpgme_error_t setPrimaryUserid (int uid_indx);
159     gpgme_error_t setKeyExpireDate (int key_index, long exp_timestamp,
160     bool exp_days);
161     gpgme_error_t revokeUserid (int uid_indx);
162     gpgme_error_t revokeSignature (int uid_index, int sig_index);
163     gpgme_error_t revokeSubkey (int key_index, int reason, const char *cmt);
164     gpgme_error_t addDesignatedRevoker (const char *uid);
165     gpgme_error_t addPhotoid (const char *jpg_file);
166     gpgme_error_t enable (void);
167     gpgme_error_t disable (void);
168     gpgme_error_t setUseridPreferences (int uid_index, const char *new_prefs);
169     gpgme_error_t delUseridSignature (int uid_index, int sig_index);
170     gpgme_error_t setPreferredKeyserver (int uid_index, const char *url);
171 twoaday 119 gpgme_error_t cleanKey (void);
172 werner 37
173     gpgme_error_t getUseridInfo (gpg_uid_info_t *r_uinf);
174    
175     gpgme_error_t getDesignatedRevoker (gpg_desig_rev_t *r_rev);
176     };
177    
178     BOOL keyedit_add_subkey (winpt_key_t k, HWND dlg, listview_ctrl_t lv);
179     BOOL keyedit_add_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv);
180     BOOL keyedit_add_revoker (winpt_key_t k, HWND dlg);
181     BOOL keyedit_add_photo (winpt_key_t k, HWND dlg );
182     BOOL keyedit_change_passwd (winpt_key_t k, HWND dlg);
183     BOOL keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg);
184    
185     gpgme_error_t gpg_editkey (gpgme_ctx_t ctx, gpgme_key_t key, GpgKeyEdit *ek);
186     void gpg_uid_info_release (gpg_uid_info_t inf);
187     void gpg_desig_rev_release (gpg_desig_rev_t rev);
188    
189     #endif /*WPT_KEY_EDIT_H*/

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26