1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* certlist.c (cert_usable_p): New.

(gpgsm_cert_use_sign_p,gpgsm_cert_use_encrypt_p): New.
(gpgsm_cert_use_verify_p,gpgsm_cert_use_decrypt_p): New.
(gpgsm_add_to_certlist): Check the key usage.
* sign.c (gpgsm_sign): Ditto.
* verify.c (gpgsm_verify): Print a message wehn an unsuitable
certificate was used.
* decrypt.c (gpgsm_decrypt): Ditto
* keylist.c (print_capabilities): Determine values from the cert.
This commit is contained in:
Werner Koch 2002-04-12 18:54:34 +00:00
parent face6377c1
commit 7e07a397a0
8 changed files with 149 additions and 8 deletions

View file

@ -32,7 +32,7 @@
#include "gpgsm.h"
#include "keydb.h"
#include "i18n.h"
@ -56,12 +56,39 @@ print_key_data (KsbaCert cert, FILE *fp)
static void
print_capabilities (KsbaCert cert, FILE *fp)
{
putc ('e', fp);
putc ('s', fp);
putc ('c', fp);
putc ('E', fp);
putc ('S', fp);
putc ('C', fp);
KsbaError err;
unsigned int use;
err = ksba_cert_get_key_usage (cert, &use);
if (err == KSBA_No_Data)
{
putc ('e', fp);
putc ('s', fp);
putc ('c', fp);
putc ('E', fp);
putc ('S', fp);
putc ('C', fp);
return;
}
if (err)
{
log_error (_("error getting key usage information: %s\n"),
ksba_strerror (err));
return;
}
if ((use & KSBA_KEYUSAGE_KEY_ENCIPHERMENT))
putc ('e', fp);
if ((use & KSBA_KEYUSAGE_DIGITAL_SIGNATURE))
putc ('s', fp);
if ((use & KSBA_KEYUSAGE_KEY_CERT_SIGN))
putc ('c', fp);
if ((use & KSBA_KEYUSAGE_KEY_ENCIPHERMENT))
putc ('E', fp);
if ((use & KSBA_KEYUSAGE_DIGITAL_SIGNATURE))
putc ('S', fp);
if ((use & KSBA_KEYUSAGE_KEY_CERT_SIGN))
putc ('C', fp);
}