diff options
author | Werner Koch <wk@gnupg.org> | 2003-07-01 10:34:45 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2003-07-01 10:34:45 +0200 |
commit | 39046ea7ec221efa9db946230ddc9fb3e65d19ab (patch) | |
tree | aa251dc190129aef89d82597f7ffb53ba6486fc9 /g10/keyid.c | |
parent | Key generation and signing using the OpenPGP card does rudimentary work. (diff) | |
download | gnupg2-39046ea7ec221efa9db946230ddc9fb3e65d19ab.tar.xz gnupg2-39046ea7ec221efa9db946230ddc9fb3e65d19ab.zip |
* app-openpgp.c (store_fpr): Fixed fingerprint calculation.
* keygen.c (gen_card_key): Obviously we should use the creation
date received from SCDAEMON, so that the fingerprints will match.
* sign.c (do_sign): Pass the serialno to the sign code.
* keyid.c (serialno_and_fpr_from_sk): New.
Diffstat (limited to 'g10/keyid.c')
-rw-r--r-- | g10/keyid.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/g10/keyid.c b/g10/keyid.c index 49a316db5..54a79bcdb 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -62,7 +62,6 @@ do_fingerprint_md( PKT_public_key *pk ) gcry_md_open (&md, pk->version < 4 ? DIGEST_ALGO_RMD160 : DIGEST_ALGO_SHA1, 0); - gcry_md_start_debug (md,"keyid"); n = pk->version < 4 ? 8 : 6; for(i=0; i < npkey; i++ ) { size_t nbytes; @@ -575,4 +574,33 @@ fingerprint_from_sk( PKT_secret_key *sk, byte *array, size_t *ret_len ) } +/* Create a serialno/fpr string from the serial number and the secret + * key. caller must free the returned string. There is no error + * return. */ +char * +serialno_and_fpr_from_sk (const unsigned char *sn, size_t snlen, + PKT_secret_key *sk) +{ + unsigned char fpr[MAX_FINGERPRINT_LEN]; + size_t fprlen; + char *buffer, *p; + int i; + + fingerprint_from_sk (sk, fpr, &fprlen); + buffer = p= xmalloc (snlen*2 + 1 + fprlen*2 + 1); + for (i=0; i < snlen; i++, p+=2) + sprintf (p, "%02X", sn[i]); + *p++ = '/'; + for (i=0; i < fprlen; i++, p+=2) + sprintf (p, "%02X", fpr[i]); + *p = 0; + return buffer; +} + + + + + + + |