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

Legend:
Removed from v.23  
changed lines
  Added in v.37

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26