1 |
/* wptKeylist.h - Keylist element |
/* wptKeylist.h - Keylist element |
2 |
* Copyright (C) 2001-2005 Timo Schulz |
* Copyright (C) 2001-2006 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
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, |
31 |
KEY_SORT_VALIDITY = 5, |
KEY_SORT_VALIDITY = 5, |
32 |
KEY_SORT_OTRUST = 6, |
KEY_SORT_OTRUST = 6, |
33 |
KEY_SORT_CREATED = 7, |
KEY_SORT_CREATED = 7, |
34 |
KEY_SORT_ALGO = 8 |
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. */ |
/* 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, |
57 |
KEYFLAG_DISABLED = 4 |
KEYFLAG_DISABLED = 4 |
58 |
}; |
}; |
59 |
|
|
60 |
/* Signature verification context for a file. */ |
/* Symbolic column IDs. */ |
61 |
struct file_sig_ctx_s { |
enum km_col_t { |
62 |
char *file; /* plaintext file name */ |
KM_COL_UID = 0, |
63 |
gpgme_signature_t sig; /* the actual signature */ |
KM_COL_KEYID = 1, |
64 |
unsigned use_uid:1; /* 1=if the user id from context should be used. */ |
KM_COL_TYPE = 2, |
65 |
const char *user_id; |
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 |
}; |
}; |
|
typedef struct file_sig_ctx_s *file_sig_ctx_t; |
|
89 |
|
|
90 |
/*-- keylist.c --*/ |
/*-- keylist.c --*/ |
91 |
|
const char* get_key_pubalgo2 (gpgme_pubkey_algo_t alg); |
92 |
const char* get_key_pubalgo (gpgme_pubkey_algo_t alg); |
const char* get_key_pubalgo (gpgme_pubkey_algo_t alg); |
93 |
const char * get_key_algo( gpgme_key_t key, int keyidx ); |
const char* get_key_algo( gpgme_key_t key, int keyidx ); |
94 |
const char * get_key_created( long timestamp ); |
const char* get_key_created( long timestamp ); |
95 |
const char * get_key_expire_date( long timestamp ); |
const char* get_key_expire_date( long timestamp ); |
96 |
const char * get_key_type( gpgme_key_t key ); |
const char* get_key_type( gpgme_key_t key ); |
97 |
const char * get_key_size( gpgme_key_t key, int keyidx ); |
const char* get_key_size( gpgme_key_t key, int keyidx ); |
98 |
const char * get_key_fpr( gpgme_key_t key ); |
const char* get_key_fpr( gpgme_key_t key ); |
99 |
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); |
100 |
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); |
101 |
const char * get_key_trust_str (int val); |
const char* get_key_trust_str (int val); |
102 |
int find_secret_key( gpgme_key_t key ); |
|
103 |
|
char* get_key_desc (gpgme_key_t key); |
104 |
|
|
105 |
gpgme_user_id_t get_nth_userid (gpgme_key_t key, int idx); |
gpgme_user_id_t get_nth_userid (gpgme_key_t key, int idx); |
106 |
int count_userids (gpgme_key_t key); |
int count_userids (gpgme_key_t key); |
114 |
void keylist_delete( listview_ctrl_t lv ); |
void keylist_delete( listview_ctrl_t lv ); |
115 |
int keylist_add_key (listview_ctrl_t lv, int mode, gpgme_key_t key); |
int keylist_add_key (listview_ctrl_t lv, int mode, gpgme_key_t key); |
116 |
void keylist_upd_key (listview_ctrl_t lv, int pos, gpgme_key_t key); |
void keylist_upd_key (listview_ctrl_t lv, int pos, gpgme_key_t key); |
117 |
|
void keylist_upd_col (listview_ctrl_t lv, int col); |
118 |
gpgme_key_t* keylist_get_recipients( listview_ctrl_t lv, |
gpgme_key_t* keylist_get_recipients( listview_ctrl_t lv, |
119 |
int *r_force_trust, int *r_count ); |
int *r_force_trust, int *r_count ); |
120 |
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, int *r_count ); |
127 |
void implist_delete( listview_ctrl_t lv ); |
void implist_delete( listview_ctrl_t lv ); |
128 |
|
|
129 |
/*-- wptSigList.cpp --*/ |
/*-- wptSigList.cpp --*/ |
130 |
listview_ctrl_t siglist_load( HWND ctrl, const char *keyid ); |
listview_ctrl_t siglist_load (HWND ctrl, const char *keyid); |
131 |
void siglist_delete( listview_ctrl_t lv ); |
void siglist_delete (listview_ctrl_t lv); |
132 |
|
void siglist_sort (listview_ctrl_t sigl, int sortby); |
133 |
|
|
134 |
/*-- wptVerifyList.cpp --*/ |
/*-- wptVerifyList.cpp --*/ |
135 |
int verlist_build (listview_ctrl_t *lv, HWND ctrl, int fm_mode); |
int verlist_build (listview_ctrl_t *lv, HWND ctrl, int fm_mode); |