diff options
Diffstat (limited to 'sm/fingerprint.c')
-rw-r--r-- | sm/fingerprint.c | 13 |
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 |