/[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 25 by twoaday, Wed Oct 12 10:04:26 2005 UTC revision 260 by twoaday, Wed Aug 16 10:01:30 2006 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      GPG_EDITKEY_REVUID  = 24,
50  };      GPG_EDITKEY_CLEAN   = 25,
51        GPG_EDITKEY_NOTATION= 26,
52  /* Reasons for revocations. */      GPG_EDITKEY_MINIMIZE= 27,
53  enum {      GPG_EDITKEY_ADDCARDKEY=28
54      GPG_REVOKE_INSECURE   = 1,  };
55      GPG_REVOKE_SUPERSEDED = 2,  
56      GPG_REVOKE_NOUSED     = 3  /* Reasons for revocations. */
57  };  enum gpg_revoke_t {
58        GPG_REVOKE_INSECURE   = 1,
59        GPG_REVOKE_SUPERSEDED = 2,
60  /* Possible results for the operation. */      GPG_REVOKE_NOUSED     = 3
61  enum {  };
62      GPG_EDITRES_ALREADY_SIGNED = 1,  
63      GPG_EDITRES_BAD_PASSPHRASE = 2  /* Contain information about designated revokers. */
64  };  struct gpg_desig_rev_s {
65        struct gpg_desig_rev_s *next;
66  /* Contain information about designated revokers. */      gpgme_pubkey_algo_t pubkey_algo;
67  struct gpg_desig_rev_s {      char fpr[41];
68      struct gpg_desig_rev_s *next;  };
69      gpgme_pubkey_algo_t pubkey_algo;  typedef struct gpg_desig_rev_s *gpg_desig_rev_t;
70      char fpr[41];  
71  };  /* Context to hold all user-ID information. */
72  typedef struct gpg_desig_rev_s *gpg_desig_rev_t;  struct gpg_user_id_info_s {
73        struct gpg_user_id_info_s *next;
74  /* Context to hold all user-ID information. */      struct {
75  struct gpg_user_id_info_s {          unsigned int revoked:1;
76      struct gpg_user_id_info_s *next;          unsigned int invalid:1;
77      struct {          unsigned int primary:1;
78          unsigned int revoked:1;          unsigned int mdc:1;
79          unsigned int invalid:1;          unsigned int no_ks_modify:1;
80          unsigned int primary:1;      } flags;
81          unsigned int mdc:1;      int  validity;
82          unsigned int no_ks_modify:1;      char *name;
83      } flags;      char *email;
84      int  validity;      char *prefs;    
85      char *name;      int  index;
86      char *email;  };
87      char *prefs;      typedef struct gpg_user_id_info_s *gpg_uid_info_t;
88      int  index;  
89  };  /* Class to abstract the gpg edit key interface. */
90  typedef struct gpg_user_id_info_s *gpg_uid_info_t;  class GpgKeyEdit {
91    private:
92  /* Class to abstract the gpg edit key interface. */      gpgme_key_t key;
93  class GpgKeyEdit {      gpgme_ctx_t ctx;
94  private:      int resval;
95      gpgme_key_t key;      int type;
96      gpgme_ctx_t ctx;  
97      int resval;      bool key_has_passwd;
98    
99  public:      int sig_index;  /* signature index. */
100      int type;      int key_index;  /* key index. */
101      int cnt;      int uid_index;  /* userid index. */
102      int cmd_sent;  
103      const char *pass;      int valid;
104      const char *new_pass;  
105      int sig_index;  public:
106      int key_index;      int cnt;
107      int uid_index;      int cmd_sent;
108      const char *url;      const char *pass;
109      int trust_id;      const char *new_pass;
110      char *name, *cmt, *email;      const char *new_prefs;
111      const char *exp_date; /* XXX */      const char *url;
112      gpgme_pubkey_algo_t pubkey_algo;      int trust_id;
113      int pubkey_size;      char *notation;
114      int valid; /* XXX */      char *name, *cmt, *email;
115      int flags;      const char *exp_date; /* XXX */
116      int sig_class;      gpgme_pubkey_algo_t pubkey_algo;
117      int reason;      unsigned int pubkey_size;
118        int flags;
119  public:      int sig_class;
120      GpgKeyEdit (gpgme_key_t key);      int reason;
121      GpgKeyEdit (const char *keyid);  
122      ~GpgKeyEdit (void);  public:
123        GpgKeyEdit (gpgme_key_t key);
124      bool isValid (void);      GpgKeyEdit (const char *keyid);
125      gpgme_key_t getKey (void);      ~GpgKeyEdit (void);
126      void reset (void);  
127        bool isValid (void);
128      void setPassphrase (const char *pass);      void reset (void);
129      void setKey (gpgme_key_t key);  
130      void setKeyID (const char *keyid);      void clear (void);
131      void setLocalUser (gpgme_key_t locusr);      void clearPassphrase (void);
132      void setCallback (gpgme_progress_cb_t cb, void *cb_value);  
133        void setNoPassphrase (bool val);
134      void setResultValue (int val);      void setPassphrase (const char *_pass);
135      int  getResultValue (void);      void setPassphrase2 (const char *_pass2);
136        void setKey (gpgme_key_t key);
137      gpgme_error_t signKey (int mode, int sig_class, const char *exp_date);      void setKeyID (const char *keyid);
138      gpgme_error_t setTrust (gpgme_validity_t trust);      void setLocalUser (gpgme_key_t locusr);
139      gpgme_error_t addUserid (const char *name, const char *cmt,      void setCallback (gpgme_progress_cb_t cb, void *cb_value);    
140                               const char *email);      void setResult (int val);
141      gpgme_error_t delUserid (int index);      int  getResult (void);
142      gpgme_error_t delKey (int index);  
143      gpgme_error_t addSubkey (gpgme_pubkey_algo_t pubkey_algo,      gpgme_key_t getKey (void);
144                               unsigned int nbits, long valid);      int getType (void);
145      gpgme_error_t changePassphrase (const char *new_pass, int allow_empty);      int getUseridIndex (void);
146      gpgme_error_t setPrimaryUserid (int uid_indx);      int getKeyIndex (void);
147      gpgme_error_t setKeyExpireDate (int key_index, long exp_timestamp,      int getSigIndex (void);
148                                      bool exp_days);      int getValidDays (void);
149      gpgme_error_t revokeUserid (int uid_indx);  
150      gpgme_error_t revokeSignature (int uid_index, int sig_index);      gpgme_error_t addNotation (int uid_idx, const char *notation);
151      gpgme_error_t revokeSubkey (int key_index, int reason, const char *cmt);      gpgme_error_t signUserid (int uid_idx, int mode, int sig_class,
152      gpgme_error_t addDesignatedRevoker (const char *uid);                                const char *exp_date);
153      gpgme_error_t addPhotoid (const char *jpg_file);      gpgme_error_t signKey (int mode, int sig_class, const char *exp_date);
154      gpgme_error_t enable (void);      gpgme_error_t setTrust (gpgme_validity_t trust);
155      gpgme_error_t disable (void);      gpgme_error_t addUserid (const char *name, const char *cmt,
156      gpgme_error_t setUseridPreferences (int uid_index, const char *new_prefs);                               const char *email);
157      gpgme_error_t delUseridSignature (int uid_index, int sig_index);      gpgme_error_t delUserid (int index);
158      gpgme_error_t setPreferredKeyserver (int uid_index, const char *url);      gpgme_error_t delKey (int index);
159        gpgme_error_t addSubkey (gpgme_pubkey_algo_t pubkey_algo,
160      gpgme_error_t getUseridInfo (gpg_uid_info_t *r_uinf);                               unsigned int nbits, long valid);
161        gpgme_error_t changePassphrase (const char *new_pass, int allow_empty);
162      gpgme_error_t getDesignatedRevoker (gpg_desig_rev_t *r_rev);      gpgme_error_t setPrimaryUserid (int uid_indx);
163  };      gpgme_error_t setKeyExpireDate (int key_index, long exp_timestamp,
164                                        bool exp_days);
165  BOOL keyedit_add_subkey (winpt_key_t k, HWND dlg, listview_ctrl_t lv);      gpgme_error_t revokeUserid (int uid_indx);
166  BOOL keyedit_add_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv);      gpgme_error_t revokeSignature (int uid_index, int sig_index);
167  BOOL keyedit_add_revoker (winpt_key_t k, HWND dlg);      gpgme_error_t revokeSubkey (int key_index, int reason, const char *cmt);
168  BOOL keyedit_add_photo (winpt_key_t k, HWND dlg );      gpgme_error_t addDesignatedRevoker (const char *uid);
169  BOOL keyedit_change_passwd (winpt_key_t k, HWND dlg);      gpgme_error_t addPhotoid (const char *jpg_file);
170  BOOL keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg);      gpgme_error_t enable (void);
171        gpgme_error_t disable (void);
172  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);
173  void          gpg_uid_info_release (gpg_uid_info_t inf);      gpgme_error_t delUseridSignature (int uid_index, int sig_index);
174  void          gpg_desig_rev_release (gpg_desig_rev_t rev);      gpgme_error_t setPreferredKeyserver (int uid_index, const char *url);
175        gpgme_error_t cleanKey (void);
176  #endif /*WPT_KEY_EDIT_H*/      gpgme_error_t minimizeKey (void);
177    
178        gpgme_error_t addCardKey (int type);
179    
180        gpgme_error_t getUseridInfo (gpg_uid_info_t *r_uinf);
181    
182        gpgme_error_t getDesignatedRevoker (gpg_desig_rev_t *r_rev);
183    };
184    
185    BOOL keyedit_add_subkey (winpt_key_t k, HWND dlg, listview_ctrl_t lv);
186    BOOL keyedit_add_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv);
187    BOOL keyedit_add_revoker (winpt_key_t k, HWND dlg);
188    BOOL keyedit_add_photo (winpt_key_t k, HWND dlg );
189    BOOL keyedit_change_passwd (winpt_key_t k, HWND dlg);
190    BOOL keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg);
191    
192    gpgme_error_t gpg_editkey (gpgme_ctx_t ctx, gpgme_key_t key, GpgKeyEdit *ek);
193    void          gpg_uid_info_release (gpg_uid_info_t inf);
194    void          gpg_desig_rev_release (gpg_desig_rev_t rev);
195    
196    #endif /*WPT_KEY_EDIT_H*/

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26