|
/* 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-2005 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 |
|
/* Available sort-by modes. */ |
24 |
|
enum key_sort_t { |
25 |
|
KEY_SORT_USERID = 0, |
26 |
|
KEY_SORT_KEYID = 1, |
27 |
|
KEY_SORT_IS_SECRET = 2, |
28 |
|
KEY_SORT_LEN = 3, |
29 |
|
KEY_SORT_VALIDITY = 5, |
30 |
|
KEY_SORT_OTRUST = 6, |
31 |
|
KEY_SORT_CREATED = 7, |
32 |
|
KEY_SORT_ALGO = 8 |
33 |
|
}; |
34 |
|
|
35 |
|
/* Valid keylist modes. */ |
36 |
|
enum keylist_mode_t { |
37 |
|
KEYLIST_ALL = 0, |
38 |
|
KEYLIST_LIST = 1, |
39 |
|
KEYLIST_ENCRYPT = 2, |
40 |
|
KEYLIST_ENCRYPT_MIN = 4, |
41 |
|
KEYLIST_SIGN = 8, |
42 |
|
KEYLIST_FLAG_FILE = 16, |
43 |
|
KEYLIST_FLAG_SHORT = 32 |
44 |
|
}; |
45 |
|
|
46 |
|
/* All possible key flags. */ |
47 |
|
enum key_flag_t { |
48 |
|
KEYFLAG_NONE = 0, |
49 |
|
KEYFLAG_EXPIRED = 1, |
50 |
|
KEYFLAG_REVOKED = 2, |
51 |
|
KEYFLAG_DISABLED = 4 |
52 |
|
}; |
53 |
|
|
54 |
|
/* Symbolic column IDs. */ |
55 |
|
enum km_col_t { |
56 |
|
KM_COL_UID = 0, |
57 |
|
KM_COL_KEYID = 1, |
58 |
|
KM_COL_TYPE = 2, |
59 |
|
KM_COL_SIZE = 3, |
60 |
|
KM_COL_CIPHER = 4, |
61 |
|
KM_COL_VALID = 5, |
62 |
|
KM_COL_TRUST = 6, |
63 |
|
KM_COL_CREAT = 7 |
64 |
|
}; |
65 |
|
|
66 |
|
/* Icon for the key types. */ |
67 |
|
enum key_image_t { |
68 |
|
KEY_IMG_PUB = 0, |
69 |
|
KEY_IMG_PAIR= 1 |
70 |
|
}; |
71 |
|
|
72 |
|
/* Signature verification context for a file. */ |
73 |
|
struct file_sig_ctx_s { |
74 |
|
char *file; /* plaintext file name */ |
75 |
|
gpgme_signature_t sig; /* the actual signature */ |
76 |
|
unsigned use_uid:1; /* 1=if the user id from context should be used. */ |
77 |
|
const char *user_id; |
78 |
|
}; |
79 |
|
typedef struct file_sig_ctx_s *file_sig_ctx_t; |
80 |
|
|
81 |
|
/*-- keylist.c --*/ |
82 |
|
const char* get_key_pubalgo2 (gpgme_pubkey_algo_t alg); |
83 |
|
const char* get_key_pubalgo (gpgme_pubkey_algo_t alg); |
84 |
|
const char * get_key_algo( gpgme_key_t key, int keyidx ); |
85 |
|
const char * get_key_created( long timestamp ); |
86 |
|
const char * get_key_expire_date( long timestamp ); |
87 |
|
const char * get_key_type( gpgme_key_t key ); |
88 |
|
const char * get_key_size( gpgme_key_t key, int keyidx ); |
89 |
|
const char * get_key_fpr( gpgme_key_t key ); |
90 |
|
const char * get_key_trust (gpgme_key_t key, int uididx, int listmode); |
91 |
|
const char * get_key_trust2 (gpgme_key_t key, int val, int uididx, int listmode); |
92 |
|
const char * get_key_trust_str (int val); |
93 |
|
|
94 |
|
gpgme_user_id_t get_nth_userid (gpgme_key_t key, int idx); |
95 |
|
int count_userids (gpgme_key_t key); |
96 |
|
gpgme_subkey_t get_nth_key (gpgme_key_t key, int idx); |
97 |
|
int count_subkeys (gpgme_key_t key); |
98 |
|
gpgme_key_sig_t get_selfsig (gpgme_user_id_t uid, const char *keyid, int first); |
99 |
|
|
100 |
|
listview_ctrl_t keylist_load( HWND ctrl, gpg_keycache_t pubkc, gpg_keycache_t seckc, |
101 |
|
int mode, int sortby ); |
102 |
|
int keylist_reload( listview_ctrl_t lv, gpg_keycache_t c, int mode, int sortby ); |
103 |
|
void keylist_delete( listview_ctrl_t lv ); |
104 |
|
int keylist_add_key (listview_ctrl_t lv, int mode, gpgme_key_t key); |
105 |
|
void keylist_upd_key (listview_ctrl_t lv, int pos, gpgme_key_t key); |
106 |
|
void keylist_upd_col (listview_ctrl_t lv, int col); |
107 |
|
gpgme_key_t* keylist_get_recipients( listview_ctrl_t lv, |
108 |
|
int *r_force_trust, int *r_count ); |
109 |
|
gpgme_key_t* keylist_enum_recipients( listview_ctrl_t lv, int listype, int *r_count ); |
110 |
|
int keylist_sort( listview_ctrl_t lv, int sortby ); |
111 |
|
|
112 |
|
/*-- wptImportList.cpp --*/ |
113 |
|
int implist_build( listview_ctrl_t *lv, HWND ctrl ); |
114 |
|
int implist_load( listview_ctrl_t lv, const char *file, |
115 |
|
int *r_revcerts, int *r_seckeys ); |
116 |
|
void implist_delete( listview_ctrl_t lv ); |
117 |
|
|
118 |
|
/*-- wptSigList.cpp --*/ |
119 |
|
listview_ctrl_t siglist_load( HWND ctrl, const char *keyid ); |
120 |
|
void siglist_delete( listview_ctrl_t lv ); |
121 |
|
|
122 |
|
/*-- wptVerifyList.cpp --*/ |
123 |
|
int verlist_build (listview_ctrl_t *lv, HWND ctrl, int fm_mode); |
124 |
|
void verlist_delete (listview_ctrl_t lv); |
125 |
|
void verlist_alloc (listview_ctrl_t lv, int nentries ); |
126 |
|
int verlist_add_sig (listview_ctrl_t lv, gpgme_signature_t sig); |
127 |
|
int verlist_add_sig_log (listview_ctrl_t lv, file_sig_ctx_t log); |
128 |
|
|
129 |
|
/*-- seclist --*/ |
130 |
|
struct keylist_s { |
131 |
|
struct keylist_s * next; |
132 |
|
gpgme_key_t key; |
133 |
|
}; |
134 |
|
typedef struct keylist_s *keylist_t; |
135 |
|
|
136 |
|
void seclist_destroy (keylist_t * list); |
137 |
|
void seclist_init (HWND dlg, int ctlid, int flags, keylist_t * ret_list); |
138 |
|
int seclist_select_key (HWND dlg, int ctlid, gpgme_key_t * ret_key); |
139 |
|
|
140 |
|
#endif /* WPT_KEYLIST_H */ |