diff options
Diffstat (limited to 'sm/fingerprint.c')
| -rw-r--r-- | sm/fingerprint.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sm/fingerprint.c b/sm/fingerprint.c index 9453a6eab..a612f3b87 100644 --- a/sm/fingerprint.c +++ b/sm/fingerprint.c @@ -102,3 +102,26 @@ gpgsm_get_fingerprint_string (KsbaCert cert, int algo) return buf; } +/* Return an allocated buffer with the formatted fungerprint as one + large hexnumber */ +char * +gpgsm_get_fingerprint_hexstring (KsbaCert cert, int algo) +{ + unsigned char digest[MAX_DIGEST_LEN]; + char *buf; + int len, i; + + if (!algo) + algo = GCRY_MD_SHA1; + + len = gcry_md_get_algo_dlen (algo); + assert (len <= MAX_DIGEST_LEN ); + gpgsm_get_fingerprint (cert, algo, digest, NULL); + buf = xmalloc (len*3+1); + *buf = 0; + for (i=0; i < len; i++ ) + sprintf (buf+strlen(buf), "%02X", digest[i]); + return buf; +} + + |
