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

Diff of /trunk/Include/wptKeyEdit.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by twoaday, Wed Aug 10 11:33:35 2005 UTC revision 25 by twoaday, Wed Oct 12 10:04:26 2005 UTC
# Line 21  Line 21 
21  #ifndef WPT_KEY_EDIT_H  #ifndef WPT_KEY_EDIT_H
22  #define WPT_KEY_EDIT_H  #define WPT_KEY_EDIT_H
23    
24    /* IDs for all possible gpg edit key commands. */
25    enum {
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        GPG_EDITKEY_REVUID  = 24
50    };
51    
52    /* Reasons for revocations. */
53    enum {
54        GPG_REVOKE_INSECURE   = 1,
55        GPG_REVOKE_SUPERSEDED = 2,
56        GPG_REVOKE_NOUSED     = 3
57    };
58    
59    
60    /* Possible results for the operation. */
61    enum {
62        GPG_EDITRES_ALREADY_SIGNED = 1,
63        GPG_EDITRES_BAD_PASSPHRASE = 2
64    };
65    
66    /* Contain information about designated revokers. */
67    struct gpg_desig_rev_s {
68        struct gpg_desig_rev_s *next;
69        gpgme_pubkey_algo_t pubkey_algo;
70        char fpr[41];
71    };
72    typedef struct gpg_desig_rev_s *gpg_desig_rev_t;
73    
74    /* Context to hold all user-ID information. */
75    struct gpg_user_id_info_s {
76        struct gpg_user_id_info_s *next;
77        struct {
78            unsigned int revoked:1;
79            unsigned int invalid:1;
80            unsigned int primary:1;
81            unsigned int mdc:1;
82            unsigned int no_ks_modify:1;
83        } flags;
84        int  validity;
85        char *name;
86        char *email;
87        char *prefs;    
88        int  index;
89    };
90    typedef struct gpg_user_id_info_s *gpg_uid_info_t;
91    
92    /* Class to abstract the gpg edit key interface. */
93    class GpgKeyEdit {
94    private:
95        gpgme_key_t key;
96        gpgme_ctx_t ctx;
97        int resval;
98    
99    public:
100        int type;
101        int cnt;
102        int cmd_sent;
103        const char *pass;
104        const char *new_pass;
105        int sig_index;
106        int key_index;
107        int uid_index;
108        const char *url;
109        int trust_id;
110        char *name, *cmt, *email;
111        const char *exp_date; /* XXX */
112        gpgme_pubkey_algo_t pubkey_algo;
113        int pubkey_size;
114        int valid; /* XXX */
115        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        gpgme_key_t getKey (void);
126        void reset (void);
127    
128        void setPassphrase (const char *pass);
129        void setKey (gpgme_key_t key);
130        void setKeyID (const char *keyid);
131        void setLocalUser (gpgme_key_t locusr);
132        void setCallback (gpgme_progress_cb_t cb, void *cb_value);
133    
134        void setResultValue (int val);
135        int  getResultValue (void);
136    
137        gpgme_error_t signKey (int mode, int sig_class, const char *exp_date);
138        gpgme_error_t setTrust (gpgme_validity_t trust);
139        gpgme_error_t addUserid (const char *name, const char *cmt,
140                                 const char *email);
141        gpgme_error_t delUserid (int index);
142        gpgme_error_t delKey (int index);
143        gpgme_error_t addSubkey (gpgme_pubkey_algo_t pubkey_algo,
144                                 unsigned int nbits, long valid);
145        gpgme_error_t changePassphrase (const char *new_pass, int allow_empty);
146        gpgme_error_t setPrimaryUserid (int uid_indx);
147        gpgme_error_t setKeyExpireDate (int key_index, long exp_timestamp,
148                                        bool exp_days);
149        gpgme_error_t revokeUserid (int uid_indx);
150        gpgme_error_t revokeSignature (int uid_index, int sig_index);
151        gpgme_error_t revokeSubkey (int key_index, int reason, const char *cmt);
152        gpgme_error_t addDesignatedRevoker (const char *uid);
153        gpgme_error_t addPhotoid (const char *jpg_file);
154        gpgme_error_t enable (void);
155        gpgme_error_t disable (void);
156        gpgme_error_t setUseridPreferences (int uid_index, const char *new_prefs);
157        gpgme_error_t delUseridSignature (int uid_index, int sig_index);
158        gpgme_error_t setPreferredKeyserver (int uid_index, const char *url);
159    
160        gpgme_error_t getUseridInfo (gpg_uid_info_t *r_uinf);
161    
162        gpgme_error_t getDesignatedRevoker (gpg_desig_rev_t *r_rev);
163    };
164    
165  BOOL keyedit_add_subkey (winpt_key_t k, HWND dlg, listview_ctrl_t lv);  BOOL keyedit_add_subkey (winpt_key_t k, HWND dlg, listview_ctrl_t lv);
166  BOOL keyedit_add_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv);  BOOL keyedit_add_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv);
167  BOOL keyedit_add_revoker (winpt_key_t k, HWND dlg);  BOOL keyedit_add_revoker (winpt_key_t k, HWND dlg);
# Line 28  BOOL keyedit_add_photo (winpt_key_t k, H Line 169  BOOL keyedit_add_photo (winpt_key_t k, H
169  BOOL keyedit_change_passwd (winpt_key_t k, HWND dlg);  BOOL keyedit_change_passwd (winpt_key_t k, HWND dlg);
170  BOOL keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg);  BOOL keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg);
171    
 #endif /*WPT_KEY_EDIT_H*/  
172    gpgme_error_t gpg_editkey (gpgme_ctx_t ctx, gpgme_key_t key, GpgKeyEdit *ek);
173    void          gpg_uid_info_release (gpg_uid_info_t inf);
174    void          gpg_desig_rev_release (gpg_desig_rev_t rev);
175    
176    #endif /*WPT_KEY_EDIT_H*/

Legend:
Removed from v.22  
changed lines
  Added in v.25

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26