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

Diff of /trunk/Include/wptKeylist.h

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

revision 2 by twoaday, Mon Jan 31 11:02:21 2005 UTC revision 208 by twoaday, Mon May 1 12:22:18 2006 UTC
# Line 1  Line 1 
 /* wptKeylist.h - Keylist element  
  *      Copyright (C) 2001-2004 Timo Schulz  
  *  
  * This file is part of WinPT.  
  *  
  * WinPT is free software; you can redistribute it and/or  
  * modify it under the terms of the GNU General Public License  
  * as published by the Free Software Foundation; either version 2  
  * of the License, or (at your option) any later version.  
  *    
  * WinPT is distributed in the hope that it will be useful,  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
  * General Public License for more details.  
  *  
  * You should have received a copy of the GNU General Public License  
  * along with WinPT; if not, write to the Free Software Foundation,  
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
  */  
   
 #ifndef WPT_KEYLIST_H  
 #define WPT_KEYLIST_H  
   
 enum {    
     KEYLIST_ALL         =  0,    
     KEYLIST_LIST        =  1,    
     KEYLIST_ENCRYPT     =  2,  
     KEYLIST_ENCRYPT_MIN =  4,    
     KEYLIST_SIGN        =  8,    
     KEYLIST_FLAG_FILE   = 16,  
     KEYLIST_FLAG_SHORT  = 32,  
 };  
   
 enum {  
     KEYFLAG_NONE     = 0,  
     KEYFLAG_EXPIRED  = 1,  
     KEYFLAG_REVOKED  = 2,  
     KEYFLAG_DISABLED = 4  
 };  
   
   
 struct siglog_context_s {  
     char file[1024];      
     gpgme_sig_t sig;  
     unsigned use_uid:1;  
     const char * user_id;  
 };  
 typedef struct siglog_context_s *siglog_context_t;  
   
 /*-- keylist.c --*/  
 const char * get_key_algo( gpgme_key_t key, int keyidx );  
 const char * get_key_created( long timestamp );  
 const char * get_key_expire_date( long timestamp );  
 const char * get_key_type( gpgme_key_t key );  
 const char * get_key_size( gpgme_key_t key, int keyidx );  
 const char * get_key_fpr( gpgme_key_t key );  
 const char * get_key_trust (gpgme_key_t key, int uididx, int listmode);  
 const char * get_key_trust_str (int val);  
 int find_secret_key( gpgme_key_t key );  
   
 listview_ctrl_t keylist_load( HWND ctrl, gpgme_keycache_t pubkc, gpgme_keycache_t seckc,  
                              int mode, int sortby );  
 int keylist_reload( listview_ctrl_t lv, gpgme_keycache_t c, int mode, int sortby );  
 void keylist_delete( listview_ctrl_t lv );  
 gpgme_recipients_t keylist_get_recipients( listview_ctrl_t lv,  
                                         int *r_force_trust, int *r_count );  
 gpgme_recipients_t keylist_enum_recipients( listview_ctrl_t lv,  int listype );  
 int keylist_sort( listview_ctrl_t lv, int sortby );  
   
 /*-- wptImportList.cpp --*/  
 int  implist_build( listview_ctrl_t *lv, HWND ctrl );  
 int  implist_load( listview_ctrl_t lv, const char *file,  
                    int *r_revcerts, int *r_seckeys );  
 void implist_delete( listview_ctrl_t lv );  
   
 /*-- wptSigList.cpp --*/  
 listview_ctrl_t siglist_load( HWND ctrl, const char *keyid );  
 void siglist_delete( listview_ctrl_t lv );  
   
 /*-- wptVerifyList.cpp --*/  
 int verlist_build( listview_ctrl_t *lv, HWND ctrl, int fm_mode);  
 void verlist_delete( listview_ctrl_t lv );  
 void verlist_alloc( listview_ctrl_t lv, int nentries );  
 int verlist_add_sig( listview_ctrl_t lv, gpgme_sig_t sig );  
 int verlist_add_sig_log( listview_ctrl_t lv, siglog_context_t log );  
   
 /*-- seclist --*/  
 struct keylist_s {  
     struct keylist_s * next;  
     gpgme_key_t key;  
 };  
 typedef struct keylist_s * keylist_t;  
   
 void seclist_destroy (keylist_t * list);  
 void seclist_init (HWND dlg, int ctlid, int flags, keylist_t * ret_list);  
 int  seclist_select_key (HWND dlg, int ctlid, gpgme_key_t * ret_key);  
   
 #endif /* WPT_KEYLIST_H */  
1    /* wptKeylist.h - Keylist element
2     *      Copyright (C) 2001-2006 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    #ifndef WPT_KEYLIST_H
21    #define WPT_KEYLIST_H
22    
23    #include "wptFileManager.h"
24    
25    /* Available sort-by modes. */
26    enum key_sort_t {
27        KEY_SORT_USERID     = 0,
28        KEY_SORT_KEYID      = 1,
29        KEY_SORT_IS_SECRET  = 2,
30        KEY_SORT_LEN        = 3,
31        KEY_SORT_VALIDITY   = 5,
32        KEY_SORT_OTRUST     = 6,
33        KEY_SORT_CREATED    = 7,
34        KEY_SORT_ALGO       = 8,
35    
36        /* special attributes for signatures */
37        SIG_SORT_CLASS      = 30,
38        SIG_SORT_EXPIRE     = 31
39    };
40    
41    /* Valid keylist modes. */
42    enum keylist_mode_t {  
43        KEYLIST_ALL         =  0,  
44        KEYLIST_LIST        =  1,
45        KEYLIST_ENCRYPT     =  2, /* obsolete */
46        KEYLIST_ENCRYPT_MIN =  4,  
47        KEYLIST_SIGN        =  8,  
48        KEYLIST_FLAG_FILE   = 16,
49        KEYLIST_FLAG_SHORT  = 32
50    };
51    
52    /* All possible key flags. */
53    enum key_flag_t {
54        KEYFLAG_NONE     = 0,
55        KEYFLAG_EXPIRED  = 1,
56        KEYFLAG_REVOKED  = 2,
57        KEYFLAG_DISABLED = 4
58    };
59    
60    /* Symbolic column IDs. */
61    enum km_col_t {
62        KM_COL_UID      = 0,
63        KM_COL_KEYID    = 1,
64        KM_COL_TYPE     = 2,
65        KM_COL_SIZE     = 3,
66        KM_COL_CIPHER   = 4,
67        KM_COL_VALID    = 5,
68        KM_COL_TRUST    = 6,
69        KM_COL_CREAT    = 7,
70        KM_COL_DESC     = 8
71    };
72    
73    /* Symbolic column IDs for sig lists */
74    enum siglist_col_t {
75        SL_COL_UID = 0,
76        SL_COL_VALID = 1,
77        SL_COL_CLASS = 2,
78        SL_COL_CREATE = 3,
79        SL_COL_KEYID = 4,
80        SL_COL_EXPIRE = 5,
81        SL_COL_ALGO = 6
82    };
83    
84    /* Icon for the key types. */
85    enum key_image_t {
86        KEY_IMG_PUB = 0,
87        KEY_IMG_PAIR= 1
88    };
89    
90    /*-- keylist.c --*/
91    const char* get_key_pubalgo2 (gpgme_pubkey_algo_t alg);
92    const char* get_key_pubalgo (gpgme_pubkey_algo_t alg);
93    const char* get_key_algo( gpgme_key_t key, int keyidx );
94    const char* get_key_created( long timestamp );
95    const char* get_key_expire_date( long timestamp );
96    const char* get_key_type( gpgme_key_t key );
97    const char* get_key_size( gpgme_key_t key, int keyidx );
98    const char* get_key_fpr( gpgme_key_t key );
99    const char* get_key_trust (gpgme_key_t key, int uididx, int listmode);
100    const char* get_key_trust2 (gpgme_key_t key, int val, int uididx, int listmode);
101    const char* get_key_trust_str (int val);
102    const char* get_keyid_from_fpr (const char *fpr);
103    
104    char* get_key_desc (gpgme_key_t key);
105    
106    gpgme_user_id_t get_nth_userid (gpgme_key_t key, int idx);
107    int             count_userids (gpgme_key_t key);
108    gpgme_subkey_t  get_nth_key (gpgme_key_t key, int idx);
109    int             count_subkeys (gpgme_key_t key);
110    gpgme_key_sig_t get_selfsig (gpgme_key_sig_t sigs, const char *keyid, int first);
111    
112    listview_ctrl_t keylist_load( HWND ctrl, gpg_keycache_t pubkc, gpg_keycache_t seckc,
113                                 int mode, int sortby );
114    int keylist_reload( listview_ctrl_t lv, gpg_keycache_t c, int mode, int sortby );
115    void keylist_delete( listview_ctrl_t lv );
116    int keylist_add_key (listview_ctrl_t lv, int mode,
117                         struct keycache_s *ctx, gpgme_key_t key);
118    void keylist_upd_key (listview_ctrl_t lv, int pos,
119                          struct keycache_s *ctx, gpgme_key_t key);
120    void keylist_upd_col (listview_ctrl_t lv, int col);
121    gpgme_key_t* keylist_get_recipients( listview_ctrl_t lv,
122                                            int *r_force_trust, int *r_count );
123    gpgme_key_t* keylist_enum_recipients( listview_ctrl_t lv,  int listype, int *r_count );
124    int keylist_sort( listview_ctrl_t lv, int sortby );
125    
126    /*-- wptImportList.cpp --*/
127    int  implist_build( listview_ctrl_t *lv, HWND ctrl );
128    int  implist_load( listview_ctrl_t lv, const char *file,
129                       int *r_revcerts, int *r_seckeys );
130    void implist_delete( listview_ctrl_t lv );
131    
132    /*-- wptSigList.cpp --*/
133    listview_ctrl_t siglist_load (HWND ctrl, const char *keyid);
134    void siglist_delete (listview_ctrl_t lv);
135    void siglist_sort (listview_ctrl_t sigl, int sortby);
136    
137    /*-- wptVerifyList.cpp --*/
138    int verlist_build (listview_ctrl_t *lv, HWND ctrl, int fm_mode);
139    void verlist_delete (listview_ctrl_t lv);
140    void verlist_alloc (listview_ctrl_t lv, int nentries );
141    int verlist_add_sig (listview_ctrl_t lv, gpgme_signature_t sig);
142    int verlist_add_sig_log (listview_ctrl_t lv, file_sig_ctx_t log);
143    
144    /*-- seclist --*/
145    struct keylist_s {
146        struct keylist_s * next;
147        gpgme_key_t key;
148    };
149    typedef struct keylist_s *keylist_t;
150    
151    void seclist_destroy (keylist_t * list);
152    void seclist_init (HWND dlg, int ctlid, int flags, keylist_t * ret_list);
153    int  seclist_select_key (HWND dlg, int ctlid, gpgme_key_t * ret_key);
154    
155    #endif /* WPT_KEYLIST_H */

Legend:
Removed from v.2  
changed lines
  Added in v.208

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26