20 |
#ifndef WPT_KEYLIST_H |
#ifndef WPT_KEYLIST_H |
21 |
#define WPT_KEYLIST_H |
#define WPT_KEYLIST_H |
22 |
|
|
23 |
|
#include "wptFileManager.h" |
24 |
|
|
25 |
/* Available sort-by modes. */ |
/* Available sort-by modes. */ |
26 |
enum key_sort_t { |
enum key_sort_t { |
27 |
KEY_SORT_USERID = 0, |
KEY_SORT_USERID = 0, |
41 |
/* Valid keylist modes. */ |
/* Valid keylist modes. */ |
42 |
enum keylist_mode_t { |
enum keylist_mode_t { |
43 |
KEYLIST_ALL = 0, |
KEYLIST_ALL = 0, |
44 |
KEYLIST_LIST = 1, |
KEYLIST_LIST = 1, |
45 |
KEYLIST_ENCRYPT = 2, |
KEYLIST_ENCRYPT = 2, /* obsolete */ |
46 |
KEYLIST_ENCRYPT_MIN = 4, |
KEYLIST_ENCRYPT_MIN = 4, |
47 |
KEYLIST_SIGN = 8, |
KEYLIST_SIGN = 8, |
48 |
KEYLIST_FLAG_FILE = 16, |
KEYLIST_FLAG_FILE = 16, |
84 |
/* Icon for the key types. */ |
/* Icon for the key types. */ |
85 |
enum key_image_t { |
enum key_image_t { |
86 |
KEY_IMG_PUB = 0, |
KEY_IMG_PUB = 0, |
87 |
KEY_IMG_PAIR= 1 |
KEY_IMG_PAIR= 1, |
88 |
}; |
KEY_IMG_SORT_DOWN = 2, |
89 |
|
KEY_IMG_SORT_UP |
|
/* Signature verification context for a file. */ |
|
|
struct file_sig_ctx_s { |
|
|
char *file; /* plaintext file name */ |
|
|
gpgme_signature_t sig; /* the actual signature */ |
|
|
unsigned use_uid:1; /* 1=if the user id from context should be used. */ |
|
|
const char *user_id; |
|
90 |
}; |
}; |
|
typedef struct file_sig_ctx_s *file_sig_ctx_t; |
|
91 |
|
|
92 |
/*-- keylist.c --*/ |
/*-- keylist.c --*/ |
93 |
const char* get_key_pubalgo2 (gpgme_pubkey_algo_t alg); |
const char* get_key_pubalgo2 (gpgme_pubkey_algo_t alg); |
94 |
const char* get_key_pubalgo (gpgme_pubkey_algo_t alg); |
const char* get_key_pubalgo (gpgme_pubkey_algo_t alg); |
95 |
const char* get_key_algo( gpgme_key_t key, int keyidx ); |
const char* get_key_algo( gpgme_key_t key, int keyidx ); |
96 |
const char* get_key_created( long timestamp ); |
const char* get_key_created( long timestamp ); |
97 |
const char* get_key_expire_date( long timestamp ); |
const char* get_key_expire_date( long timestamp ); |
101 |
const char* get_key_trust (gpgme_key_t key, int uididx, int listmode); |
const char* get_key_trust (gpgme_key_t key, int uididx, int listmode); |
102 |
const char* get_key_trust2 (gpgme_key_t key, int val, int uididx, int listmode); |
const char* get_key_trust2 (gpgme_key_t key, int val, int uididx, int listmode); |
103 |
const char* get_key_trust_str (int val); |
const char* get_key_trust_str (int val); |
104 |
|
const char* get_keyid_from_fpr (const char *fpr); |
105 |
|
|
106 |
char* get_key_desc (gpgme_key_t key); |
char* get_key_desc (gpgme_key_t key); |
107 |
|
|
109 |
int count_userids (gpgme_key_t key); |
int count_userids (gpgme_key_t key); |
110 |
gpgme_subkey_t get_nth_key (gpgme_key_t key, int idx); |
gpgme_subkey_t get_nth_key (gpgme_key_t key, int idx); |
111 |
int count_subkeys (gpgme_key_t key); |
int count_subkeys (gpgme_key_t key); |
112 |
gpgme_key_sig_t get_selfsig (gpgme_user_id_t uid, const char *keyid, int first); |
gpgme_key_sig_t get_selfsig (gpgme_key_sig_t sigs, const char *keyid, int first); |
113 |
|
|
114 |
listview_ctrl_t keylist_load( HWND ctrl, gpg_keycache_t pubkc, gpg_keycache_t seckc, |
listview_ctrl_t keylist_load( HWND ctrl, gpg_keycache_t pubkc, gpg_keycache_t seckc, |
115 |
int mode, int sortby ); |
int mode, int sortby ); |
116 |
int keylist_reload( listview_ctrl_t lv, gpg_keycache_t c, int mode, int sortby ); |
int keylist_reload( listview_ctrl_t lv, gpg_keycache_t c, int mode, int sortby ); |
117 |
void keylist_delete( listview_ctrl_t lv ); |
void keylist_delete( listview_ctrl_t lv ); |
118 |
int keylist_add_key (listview_ctrl_t lv, int mode, gpgme_key_t key); |
int keylist_add_key (listview_ctrl_t lv, int mode, |
119 |
void keylist_upd_key (listview_ctrl_t lv, int pos, gpgme_key_t key); |
struct keycache_s *ctx, gpgme_key_t key); |
120 |
|
void keylist_upd_key (listview_ctrl_t lv, int pos, |
121 |
|
struct keycache_s *ctx, gpgme_key_t key); |
122 |
void keylist_upd_col (listview_ctrl_t lv, int col); |
void keylist_upd_col (listview_ctrl_t lv, int col); |
123 |
gpgme_key_t* keylist_get_recipients( listview_ctrl_t lv, |
gpgme_key_t* keylist_get_recipients (listview_ctrl_t lv, |
124 |
int *r_force_trust, int *r_count ); |
int *r_force_trust, size_t *r_count); |
125 |
gpgme_key_t* keylist_enum_recipients( listview_ctrl_t lv, int listype, int *r_count ); |
gpgme_key_t* keylist_enum_recipients (listview_ctrl_t lv, int listype, size_t *r_count); |
126 |
int keylist_sort( listview_ctrl_t lv, int sortby ); |
int keylist_sort( listview_ctrl_t lv, int sortby ); |
127 |
|
|
128 |
/*-- wptImportList.cpp --*/ |
/*-- wptImportList.cpp --*/ |
129 |
int implist_build( listview_ctrl_t *lv, HWND ctrl ); |
void implist_build (listview_ctrl_t *lv, HWND ctrl); |
130 |
int implist_load( listview_ctrl_t lv, const char *file, |
int implist_load (listview_ctrl_t lv, const char *file, |
131 |
int *r_revcerts, int *r_seckeys ); |
int *r_revcerts, int *r_seckeys); |
132 |
void implist_delete( listview_ctrl_t lv ); |
void implist_delete (listview_ctrl_t lv); |
133 |
|
|
134 |
/*-- wptSigList.cpp --*/ |
/*-- wptSigList.cpp --*/ |
135 |
listview_ctrl_t siglist_load (HWND ctrl, const char *keyid); |
listview_ctrl_t siglist_load (HWND ctrl, const char *keyid); |
137 |
void siglist_sort (listview_ctrl_t sigl, int sortby); |
void siglist_sort (listview_ctrl_t sigl, int sortby); |
138 |
|
|
139 |
/*-- wptVerifyList.cpp --*/ |
/*-- wptVerifyList.cpp --*/ |
140 |
int verlist_build (listview_ctrl_t *lv, HWND ctrl, int fm_mode); |
/* Verify list control context. */ |
141 |
void verlist_delete (listview_ctrl_t lv); |
struct verlist_ctrl_s { |
142 |
void verlist_alloc (listview_ctrl_t lv, int nentries ); |
listview_ctrl_t lv; /* list view control. */ |
143 |
int verlist_add_sig (listview_ctrl_t lv, gpgme_signature_t sig); |
HWND infctl; /* handle to the optional sig info control. */ |
144 |
int verlist_add_sig_log (listview_ctrl_t lv, file_sig_ctx_t log); |
}; |
145 |
|
typedef struct verlist_ctrl_s *verlist_ctrl_t; |
146 |
|
|
147 |
|
void verlist_build (verlist_ctrl_t *vlv, HWND ctrl, int fm_mode); |
148 |
|
void verlist_delete (verlist_ctrl_t vlv); |
149 |
|
void verlist_alloc (verlist_ctrl_t vlv, int nentries ); |
150 |
|
void verlist_set_info_control (verlist_ctrl_t vlv, HWND infctl); |
151 |
|
int verlist_add_sig (verlist_ctrl_t vlv, gpgme_signature_t sig); |
152 |
|
int verlist_add_sig_log (verlist_ctrl_t vlv, file_sig_ctx_t log); |
153 |
|
|
154 |
/*-- seclist --*/ |
/*-- seclist --*/ |
155 |
struct keylist_s { |
struct keylist_s { |