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 |
*/ |
*/ |
|
#ifdef HAVE_CONFIG_H |
|
|
#include <config.h> |
|
|
#endif |
|
|
|
|
|
#include <windows.h> |
|
21 |
#include <windows.h> |
#include <windows.h> |
22 |
#include <commctrl.h> |
#include <commctrl.h> |
23 |
#include <time.h> |
#include <time.h> |
216 |
|
|
217 |
|
|
218 |
const char* |
const char* |
219 |
get_key_created( long timestamp ) |
get_key_created (long timestamp) |
220 |
{ |
{ |
221 |
static char timebuf[128]; |
static char timebuf[128]; |
222 |
struct tm *warp; |
struct tm *warp; |
230 |
} /* get_key_created */ |
} /* get_key_created */ |
231 |
|
|
232 |
|
|
233 |
|
/* Return a string presentation of the time @timestamp. */ |
234 |
const char* |
const char* |
235 |
get_key_expire_date (long timestamp) |
get_key_expire_date (long timestamp) |
236 |
{ |
{ |
240 |
if( !timestamp ) |
if( !timestamp ) |
241 |
return _("Never"); |
return _("Never"); |
242 |
warp = localtime( ×tamp ); |
warp = localtime( ×tamp ); |
243 |
_snprintf( timebuf, sizeof timebuf -1, "%04d-%02d-%02d", |
_snprintf (timebuf, sizeof timebuf -1, "%04d-%02d-%02d", |
244 |
warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday ); |
warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday); |
245 |
return timebuf; |
return timebuf; |
246 |
} /* get_key_expire_date */ |
} |
247 |
|
|
248 |
|
|
249 |
const char* |
const char* |
378 |
memset (fmt, 0, sizeof (fmt)); |
memset (fmt, 0, sizeof (fmt)); |
379 |
if (listmode) { |
if (listmode) { |
380 |
if (key->revoked) |
if (key->revoked) |
381 |
sprintf (fmt, "Revoked"); |
sprintf (fmt, _("Revoked")); |
382 |
else if (key->expired) |
else if (key->expired) |
383 |
sprintf (fmt, "Expired"); |
sprintf (fmt, _("Expired")); |
384 |
else if (key->disabled) |
else if (key->disabled) |
385 |
sprintf (fmt, "Disabled"); |
sprintf (fmt, _("Disabled")); |
386 |
/* 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 |
387 |
what any user-id validities. */ |
what any user-id validities. */ |
388 |
if (strlen (fmt) > 0) |
if (strlen (fmt) > 0) |
811 |
int uids, rc = 0, i, n = 0; |
int uids, rc = 0, i, n = 0; |
812 |
gpgme_subkey_t k; |
gpgme_subkey_t k; |
813 |
|
|
814 |
|
/* if the entire key is disabled, just return. */ |
815 |
|
if (key->disabled) |
816 |
|
return 0; |
817 |
|
|
818 |
for (k=key->subkeys, i = 0; i < count_subkeys (key); i++, k=k->next) { |
for (k=key->subkeys, i = 0; i < count_subkeys (key); i++, k=k->next) { |
819 |
if (k->invalid) { |
if (k->invalid) { |
820 |
log_debug ("keylist_add_key: invalid key \"%s\"\n", key->uids->name); |
log_debug ("keylist_add_key: invalid key \"%s\"\n", key->uids->name); |
853 |
} |
} |
854 |
} |
} |
855 |
else if (mode & KEYLIST_SIGN) { |
else if (mode & KEYLIST_SIGN) { |
856 |
if ( k->can_sign |
if (k->can_sign |
857 |
&& find_secret_key( key ) |
&& find_secret_key (key) |
858 |
&& key_is_useable (k)) |
&& key_is_useable (k)) { |
|
{ |
|
859 |
rc = do_addkey (lv, key, -1, i, -1); |
rc = do_addkey (lv, key, -1, i, -1); |
860 |
if( rc ) |
if (rc) |
861 |
return rc; |
return rc; |
862 |
} |
} |
863 |
} |
} |
1051 |
gpg_keycache_rewind (kc); |
gpg_keycache_rewind (kc); |
1052 |
|
|
1053 |
while (!gpg_keycache_next_key (kc, 1, &key)) { |
while (!gpg_keycache_next_key (kc, 1, &key)) { |
1054 |
char * inf = NULL, * uid = NULL; |
char *inf = NULL, *uid = NULL; |
1055 |
const char * id; |
const char *id; |
1056 |
const char * keyid; |
const char *keyid; |
1057 |
int algo; |
int algo; |
1058 |
size_t size = 0; |
size_t size = 0; |
1059 |
|
|
1064 |
keyid = key->subkeys->keyid; |
keyid = key->subkeys->keyid; |
1065 |
algo = key->subkeys->pubkey_algo; |
algo = key->subkeys->pubkey_algo; |
1066 |
if (!id || !keyid) |
if (!id || !keyid) |
1067 |
continue; /* fixme: error? */ |
continue; |
1068 |
if (!key_is_useable (key->subkeys)) |
if (key->disabled || !key_is_useable (key->subkeys)) |
1069 |
continue; |
continue; |
1070 |
|
|
1071 |
uid = utf8_to_wincp (id, strlen (id)); |
uid = utf8_to_wincp (id, strlen (id)); |