65 |
int checked; |
int checked; |
66 |
}; |
}; |
67 |
|
|
68 |
static int find_secret_key( gpgme_key_t key ); |
static int find_secret_key (gpgme_key_t key); |
69 |
|
|
70 |
|
|
71 |
static key_array_s* |
static key_array_s* |
247 |
const char* |
const char* |
248 |
get_key_type (gpgme_key_t key) |
get_key_type (gpgme_key_t key) |
249 |
{ |
{ |
250 |
if (find_secret_key (key)) |
int type = find_secret_key (key); |
251 |
|
|
252 |
|
if (type == 1) |
253 |
return _("Key Pair"); |
return _("Key Pair"); |
254 |
|
else if (type == 2) |
255 |
|
return _("Key Pair (Card)"); |
256 |
return _("Public Key"); |
return _("Public Key"); |
257 |
} /* get_key_type */ |
} /* get_key_type */ |
258 |
|
|
619 |
|
|
620 |
|
|
621 |
static int |
static int |
622 |
find_secret_key( gpgme_key_t key ) |
find_secret_key (gpgme_key_t key) |
623 |
{ |
{ |
624 |
const char * keyid; |
const char *keyid; |
625 |
gpgme_key_t skey; |
winpt_key_s skey; |
626 |
|
|
627 |
|
memset (&skey, 0, sizeof (skey)); |
628 |
keyid = key->subkeys->keyid; |
keyid = key->subkeys->keyid; |
629 |
if (!keyid) |
if (!keyid) |
630 |
return 0; |
return 0; |
631 |
get_seckey (keyid, &skey); |
winpt_get_seckey (keyid, &skey); |
632 |
return skey? 1 : 0; |
if (skey.ext && skey.ext->gloflags.divert_to_card) |
633 |
|
return 2; |
634 |
|
return skey.ctx? 1 : 0; |
635 |
} /* find_secret_key */ |
} /* find_secret_key */ |
636 |
|
|
637 |
|
|
694 |
listview_add_sub_item( lv, 0, idx++, fmt ); |
listview_add_sub_item( lv, 0, idx++, fmt ); |
695 |
} |
} |
696 |
if (list > 0) { |
if (list > 0) { |
697 |
attr = find_secret_key (key)? "pub/sec" : "pub"; |
key_attr = find_secret_key (key); |
698 |
if (strchr( attr, '/')) { |
if (!key_attr) |
699 |
struct winpt_key_s k; |
attr = "pub"; |
700 |
winpt_get_seckey (key->subkeys->keyid, &k); |
else |
701 |
if (k.ext->gloflags.divert_to_card) |
attr = key_attr == 1? "pub/sec" : "pub/crd"; |
702 |
attr = "pub/crd"; |
listview_add_sub_item (lv, 0, idx++, attr); |
|
} |
|
|
listview_add_sub_item( lv, 0, idx++, attr ); |
|
703 |
} |
} |
704 |
if (lv->cols >= 2) { |
if (lv->cols >= 2) { |
705 |
attr = get_key_size (key, list == -1? keyidx+1 : 0); |
attr = get_key_size (key, list == -1? keyidx+1 : 0); |