18 |
* along with WinPT; if not, write to the Free Software Foundation, |
* along with WinPT; if not, write to the Free Software Foundation, |
19 |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
*/ |
*/ |
21 |
|
|
22 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
23 |
#include <config.h> |
#include <config.h> |
24 |
#endif |
#endif |
169 |
} |
} |
170 |
|
|
171 |
|
|
172 |
|
const char* |
173 |
|
get_key_pubalgo2 (gpgme_pubkey_algo_t alg) |
174 |
|
{ |
175 |
|
switch (alg) { |
176 |
|
case GPGME_PK_DSA: return "D"; |
177 |
|
case GPGME_PK_RSA: return "R"; |
178 |
|
case GPGME_PK_ELG: return "G"; |
179 |
|
default: return "?"; |
180 |
|
} |
181 |
|
return "?"; |
182 |
|
} |
183 |
|
|
184 |
const char* |
const char* |
185 |
get_key_algo (gpgme_key_t key, int keyidx) |
get_key_algo (gpgme_key_t key, int keyidx) |
370 |
uididx = 0; |
uididx = 0; |
371 |
if (listmode) { |
if (listmode) { |
372 |
const char *s; |
const char *s; |
|
|
|
373 |
if (key->revoked) |
if (key->revoked) |
374 |
s = _("Revoked"); |
s = _("Revoked"); |
375 |
else if (key->expired) |
else if (key->expired) |
378 |
s = _("Disabled"); |
s = _("Disabled"); |
379 |
else |
else |
380 |
s = ""; |
s = ""; |
|
|
|
381 |
/* if the key has a special status, we don't continue to figure out |
/* if the key has a special status, we don't continue to figure out |
382 |
what any user-id validities. */ |
what any user-id validities. */ |
383 |
if (*s) |
if (*s) |
482 |
static const char* |
static const char* |
483 |
calc_validity (gpg_group_t grp) |
calc_validity (gpg_group_t grp) |
484 |
{ |
{ |
485 |
int valid=0; |
int valid = 0; |
486 |
gpg_member_t mbr; |
gpg_member_t mbr; |
487 |
gpgme_key_t key; |
gpgme_key_t key; |
488 |
|
|
685 |
/* we check the pubkey algorithm here to make sure that no ElGamal |
/* we check the pubkey algorithm here to make sure that no ElGamal |
686 |
sign+encrypt key is used in _any_ mode */ |
sign+encrypt key is used in _any_ mode */ |
687 |
if (list != 1 && key->subkeys->pubkey_algo == GPGME_PK_ELG) { |
if (list != 1 && key->subkeys->pubkey_algo == GPGME_PK_ELG) { |
688 |
log_debug ("ElGamal (E+S) key found: %s (%s)\n", |
log_debug ("ElGamal (E+S) key found: %s (%s)\n", |
689 |
key->uids->name, key->subkeys->keyid); |
key->uids->name, key->subkeys->keyid); |
690 |
return 0; |
return 0; |
691 |
} |
} |
692 |
|
|
693 |
|
|
694 |
if (listview_add_item2 (lv, " ", (void *)key)) |
if (listview_add_item2 (lv, " ", (void *)key)) |
695 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
696 |
|
|
697 |
attr = key->uids->uid; |
attr = key->uids->uid; |
698 |
memset (&lvi, 0, sizeof lvi); |
memset (&lvi, 0, sizeof lvi); |
699 |
lvi.mask = LVIF_TEXT | LVIF_PARAM; |
lvi.mask = LVIF_TEXT | LVIF_PARAM; |
700 |
lvi.pszText = (char *)attr; |
lvi.pszText = (char *)attr; |
701 |
lvi.lParam = (LPARAM )key; |
lvi.lParam = (LPARAM )key; |
702 |
if (ListView_SetItem( lv->ctrl, &lvi ) == FALSE) |
if (ListView_SetItem (lv->ctrl, &lvi) == FALSE) |
703 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
704 |
|
|
705 |
if (uididx == -1) { /* request the primary user-id of the key. */ |
if (uididx == -1) { /* request the primary user-id of the key. */ |
835 |
if (mode & KEYLIST_ALL) { |
if (mode & KEYLIST_ALL) { |
836 |
uids = count_userids (key); |
uids = count_userids (key); |
837 |
rc = do_addkey (lv, key, uids, i, 0); |
rc = do_addkey (lv, key, uids, i, 0); |
838 |
if( rc ) |
if (rc) |
839 |
return rc; |
return rc; |
840 |
} |
} |
841 |
else if (mode & KEYLIST_LIST) |
else if (mode & KEYLIST_LIST) |
848 |
return rc; |
return rc; |
849 |
} |
} |
850 |
else { |
else { |
851 |
for( uids = 0; uids < count_userids (key); uids++ ) { |
for (uids = 0; uids < count_userids (key); uids++) { |
852 |
rc = do_addkey( lv, key, uids, i, -1 ); |
rc = do_addkey (lv, key, uids, i, -1); |
853 |
if( rc ) |
if (rc) |
854 |
return rc; |
return rc; |
855 |
} |
} |
856 |
} |
} |