aboutsummaryrefslogtreecommitdiffstats
path: root/g10/sign.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2003-07-23 07:11:06 +0000
committerWerner Koch <[email protected]>2003-07-23 07:11:06 +0000
commit44f4303bcfe1ce47717c57838d13ebd872fde0fd (patch)
treed72ec3213d44cb3e6d50df31fd1b3a279da1363e /g10/sign.c
parent* export.c (parse_export_options): New option sexp-format. (diff)
downloadgnupg-44f4303bcfe1ce47717c57838d13ebd872fde0fd.tar.gz
gnupg-44f4303bcfe1ce47717c57838d13ebd872fde0fd.zip
* keygen.c (generate_keypair): Create an AUTHKEYTYPE entry for cards.
(do_generate_keypair): Abd generate the authkey. (check_smartcard): Changed menu accordingly.
Diffstat (limited to 'g10/sign.c')
-rw-r--r--g10/sign.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/g10/sign.c b/g10/sign.c
index fa1e07b87..bdeb37d07 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -275,7 +275,43 @@ do_sign( PKT_secret_key *sk, PKT_signature *sig,
sig->digest_algo = digest_algo;
sig->digest_start[0] = dp[0];
sig->digest_start[1] = dp[1];
- if (sk->is_protected && sk->protect.s2k.mode == 1002)
+#if 0
+ if (sk->is_protected && sk->protect.s2k.mode == 1002 && !sk->is_primary)
+ { /* Temporary hack to test tey auth command. */
+ char *rbuf;
+ size_t rbuflen;
+ char *snbuf;
+ char *tmpbuf;
+ size_t tmp_n;
+
+ frame = encode_md_value( sk->pubkey_algo, md,
+ digest_algo, mpi_get_nbits(sk->skey[0]), 0 );
+ if (!frame)
+ return GPG_ERR_GENERAL;
+
+ if (gcry_mpi_aprint (GCRYMPI_FMT_USG, (void **)&tmpbuf, &tmp_n, frame ))
+ BUG ();
+ for (; tmp_n && *tmpbuf; tmp_n--, tmpbuf++)
+ ;
+ assert (tmp_n);
+ tmp_n--;
+ tmpbuf++;
+
+ snbuf = serialno_and_fpr_from_sk (sk->protect.iv, sk->protect.ivlen, sk);
+ rc = agent_scd_pksign (snbuf, 0,
+ tmpbuf, tmp_n,
+ &rbuf, &rbuflen);
+ xfree (snbuf);
+ if (!rc)
+ {
+ unsigned int nbytes = rbuflen;
+ if (gcry_mpi_scan (&sig->data[0], GCRYMPI_FMT_USG, rbuf, &nbytes ))
+ BUG ();
+ }
+ }
+ else
+#endif
+ if (sk->is_protected && sk->protect.s2k.mode == 1002)
{ /* FIXME: Note that we do only support RSA for now. */
char *rbuf;
size_t rbuflen;