58 |
void |
void |
59 |
keycache_release (int cleanup) |
keycache_release (int cleanup) |
60 |
{ |
{ |
|
int n = gpg_keycache_get_size (pub); |
|
61 |
char tmpbuf[64]; |
char tmpbuf[64]; |
62 |
|
int n = gpg_keycache_get_size (pub); |
63 |
|
|
64 |
/* XXX: update the value when the cache has changed. */ |
/* XXX: update the value when the cache has changed. */ |
65 |
sprintf (tmpbuf, "%d", n); |
sprintf (tmpbuf, "%d", n); |
256 |
static int |
static int |
257 |
sigsum_to_index (gpgme_sigsum_t sum) |
sigsum_to_index (gpgme_sigsum_t sum) |
258 |
{ |
{ |
259 |
if ((sum & GPGME_SIGSUM_VALID) && (sum & GPGME_SIGSUM_KEY_REVOKED)) |
if (sum & GPGME_SIGSUM_RED) |
260 |
|
return 2; |
261 |
|
else if (sum & GPGME_SIGSUM_SIG_EXPIRED) |
262 |
|
return 8; |
263 |
|
else if (sum & GPGME_SIGSUM_KEY_REVOKED) |
264 |
return 7; |
return 7; |
265 |
if ((sum & GPGME_SIGSUM_VALID) && (sum & GPGME_SIGSUM_SIG_EXPIRED)) |
else if (sum & GPGME_SIGSUM_KEY_EXPIRED) |
266 |
return 6; |
return 6; |
267 |
if (sum & GPGME_SIGSUM_GREEN) |
else if (sum & GPGME_SIGSUM_GREEN) |
268 |
return 1; |
return 1; |
|
else if (sum & GPGME_SIGSUM_RED) |
|
|
return 2; |
|
269 |
else if (sum & GPGME_SIGSUM_KEY_MISSING) |
else if (sum & GPGME_SIGSUM_KEY_MISSING) |
270 |
return 3; |
return 3; |
271 |
return 0; |
return 0; |
272 |
} |
} |
273 |
|
|
274 |
|
|
275 |
/* Return a humand readable description for the signature status @sum. */ |
/* Return a humand readable description for the signature status @sum. |
276 |
|
Warning: this function does not consider the validity of the key. */ |
277 |
const char* |
const char* |
278 |
get_gpg_sigstat (gpgme_sigsum_t sum) |
get_gpg_sigstat (gpgme_sigsum_t sum) |
279 |
{ |
{ |
280 |
const char *gpg_sigstat[] = { |
const char *gpg_sigstat[] = { |
281 |
_("Error during verification process."), |
_("Error during verification process"), |
282 |
_("The signature is good."), |
_("The signature is good"), |
283 |
_("The signature is BAD!"), |
_("The signature is BAD!"), |
284 |
_("The signature could not be checked due to a missing key."), |
_("The signature could not be checked due to a missing key"), |
285 |
_("No valid OpenPGP signature."), |
_("No valid OpenPGP signature"), |
286 |
_("Signature Error"), |
_("Signature Error"), |
287 |
_("Good Signature (Expired Key)"), |
_("Good signature (Expired Key)"), |
288 |
_("Good Signature (Revoked Key)"), |
_("Good signature (Revoked Key)"), |
289 |
|
_("Good signature (Expired)"), |
290 |
NULL |
NULL |
291 |
}; |
}; |
292 |
const unsigned int mask = 8; |
const unsigned int mask = 9; |
293 |
|
|
294 |
return gpg_sigstat[sigsum_to_index (sum) % mask]; |
return gpg_sigstat[sigsum_to_index (sum) % mask]; |
295 |
} |
} |
296 |
|
|
297 |
|
|
298 |
|
/* Return true if at least one secret key is available. */ |
299 |
bool |
bool |
300 |
secret_key_available (void) |
secret_key_available (void) |
301 |
{ |
{ |