mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-30 16:17:02 +01:00
* decrypt.c (gpgsm_decrypt): Write STATUS_DECRYPTION_*.
* sign.c (gpgsm_sign): Write a STATUS_SIG_CREATED.
This commit is contained in:
parent
fb446a5aeb
commit
1301c0b5ef
@ -1,3 +1,8 @@
|
||||
2001-12-15 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* decrypt.c (gpgsm_decrypt): Write STATUS_DECRYPTION_*.
|
||||
* sign.c (gpgsm_sign): Write a STATUS_SIG_CREATED.
|
||||
|
||||
2001-12-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* keylist.c (list_cert_colon): Kludge to show an email address
|
||||
|
@ -453,9 +453,12 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||
log_error ("write failed: %s\n", gnupg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
gpgsm_status (ctrl, STATUS_DECRYPTION_OKAY, NULL);
|
||||
|
||||
|
||||
leave:
|
||||
if (rc)
|
||||
gpgsm_status (ctrl, STATUS_DECRYPTION_FAILED, NULL);
|
||||
ksba_cms_release (cms);
|
||||
gpgsm_destroy_reader (b64reader);
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
|
@ -407,6 +407,8 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
}
|
||||
|
||||
/* If no recipient list is given, use a default one */
|
||||
/* FIXME: we shoudl not do this but return an error and a
|
||||
STATUS_NO_RECP */
|
||||
if (!recplist)
|
||||
{
|
||||
help_recplist.cert = get_default_recipient ();
|
||||
|
@ -81,7 +81,7 @@ gpgsm_get_fingerprint (KsbaCert cert, int algo, char *array, int *r_len)
|
||||
}
|
||||
|
||||
|
||||
/* Return an allocated buffer with the formatted fungerprint */
|
||||
/* Return an allocated buffer with the formatted fingerprint */
|
||||
char *
|
||||
gpgsm_get_fingerprint_string (KsbaCert cert, int algo)
|
||||
{
|
||||
|
44
sm/sign.c
44
sm/sign.c
@ -119,12 +119,13 @@ gpgsm_sign (CTRL ctrl, int data_fd, int detached, FILE *out_fp)
|
||||
KsbaWriter writer;
|
||||
KsbaCMS cms = NULL;
|
||||
KsbaStopReason stopreason;
|
||||
KsbaCert cert;
|
||||
KsbaCert cert = NULL;
|
||||
KEYDB_HANDLE kh = NULL;
|
||||
GCRY_MD_HD data_md = NULL;
|
||||
int signer;
|
||||
const char *algoid;
|
||||
int algo;
|
||||
time_t signed_at;
|
||||
|
||||
if (!detached)
|
||||
{
|
||||
@ -262,8 +263,9 @@ gpgsm_sign (CTRL ctrl, int data_fd, int detached, FILE *out_fp)
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
err = ksba_cms_set_signing_time (cms, signer, 0 /*now*/);
|
||||
|
||||
signed_at = time (NULL);
|
||||
err = ksba_cms_set_signing_time (cms, signer, signed_at);
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_set_signing_time failed: %s\n",
|
||||
@ -271,7 +273,7 @@ gpgsm_sign (CTRL ctrl, int data_fd, int detached, FILE *out_fp)
|
||||
rc = map_ksba_err (err);
|
||||
goto leave;
|
||||
}
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
err = ksba_cms_build (cms, &stopreason);
|
||||
@ -313,7 +315,8 @@ gpgsm_sign (CTRL ctrl, int data_fd, int detached, FILE *out_fp)
|
||||
|
||||
{ /* This is all an temporary hack */
|
||||
char *sigval;
|
||||
|
||||
|
||||
ksba_cert_release (cert);
|
||||
cert = get_default_signer ();
|
||||
if (!cert)
|
||||
{
|
||||
@ -339,6 +342,34 @@ gpgsm_sign (CTRL ctrl, int data_fd, int detached, FILE *out_fp)
|
||||
rc = map_ksba_err (err);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
/* And write a status message */
|
||||
{
|
||||
char *buf, *fpr;
|
||||
|
||||
fpr = gpgsm_get_fingerprint_hexstring (cert, GCRY_MD_SHA1);
|
||||
if (!fpr)
|
||||
{
|
||||
rc = seterr (Out_Of_Core);
|
||||
goto leave;
|
||||
}
|
||||
rc = asprintf (&buf, "%c %d %d 00 %lu %s",
|
||||
detached? 'D':'S',
|
||||
GCRY_PK_RSA, /* FIXME: get pk algo from cert */
|
||||
algo,
|
||||
(ulong)signed_at,
|
||||
fpr);
|
||||
xfree (fpr);
|
||||
if (rc < 0)
|
||||
{
|
||||
rc = seterr (Out_Of_Core);
|
||||
goto leave;
|
||||
}
|
||||
rc = 0;
|
||||
gpgsm_status (ctrl, STATUS_SIG_CREATED, buf );
|
||||
free (buf); /* yes, we must use the regular free() here */
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -350,9 +381,12 @@ gpgsm_sign (CTRL ctrl, int data_fd, int detached, FILE *out_fp)
|
||||
log_error ("write failed: %s\n", gnupg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
|
||||
log_info ("signature created\n");
|
||||
|
||||
|
||||
leave:
|
||||
ksba_cert_release (cert);
|
||||
ksba_cms_release (cms);
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
keydb_release (kh);
|
||||
|
Loading…
x
Reference in New Issue
Block a user