summaryrefslogtreecommitdiffstats
path: root/sm/fingerprint.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2002-08-10 11:14:21 +0200
committerWerner Koch <wk@gnupg.org>2002-08-10 11:14:21 +0200
commit9382b621ad2ba2769442157c400c5e8882160abe (patch)
tree63628216d42aaca29272c2183e52f5b4cd7bf73f /sm/fingerprint.c
parent* keybox-search.c (blob_cmp_fpr_part): New. (diff)
downloadgnupg2-9382b621ad2ba2769442157c400c5e8882160abe.tar.xz
gnupg2-9382b621ad2ba2769442157c400c5e8882160abe.zip
* keylist.c (list_cert_colon): Print the short fingerprint in the
key ID field. * fingerprint.c (gpgsm_get_short_fingerprint): New. * verify.c (gpgsm_verify): Print more verbose info for a good signature.
Diffstat (limited to 'sm/fingerprint.c')
-rw-r--r--sm/fingerprint.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sm/fingerprint.c b/sm/fingerprint.c
index d8b6ec4a3..6a84966db 100644
--- a/sm/fingerprint.c
+++ b/sm/fingerprint.c
@@ -102,7 +102,7 @@ gpgsm_get_fingerprint_string (KsbaCert cert, int algo)
return buf;
}
-/* Return an allocated buffer with the formatted fungerprint as one
+/* Return an allocated buffer with the formatted fingerprint as one
large hexnumber */
char *
gpgsm_get_fingerprint_hexstring (KsbaCert cert, int algo)
@@ -124,6 +124,17 @@ gpgsm_get_fingerprint_hexstring (KsbaCert cert, int algo)
return buf;
}
+/* Return a certificate ID. These are the last 4 bytes of the SHA-1
+ fingerprint. */
+unsigned long
+gpgsm_get_short_fingerprint (KsbaCert cert)
+{
+ unsigned char digest[20];
+
+ gpgsm_get_fingerprint (cert, GCRY_MD_SHA1, digest, NULL);
+ return ((digest[16]<<24)|(digest[17]<<16)|(digest[18]<< 8)|digest[19]);
+}
+
/* Return the so called KEYGRIP which is the SHA-1 hash of the public
key parameters expressed as an canoncial encoded S-Exp. array must