summaryrefslogtreecommitdiffstats
path: root/sm/fingerprint.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-11-19 13:42:01 +0100
committerWerner Koch <wk@gnupg.org>2001-11-19 13:42:01 +0100
commit0b176661453bc01663e3a2ed9bfd7f57d7f0b99f (patch)
tree231acee564ed3ac85e533d0331ec295c0c4e7a27 /sm/fingerprint.c
parentAllow to store an arbitrary pointer in the context. (diff)
downloadgnupg2-0b176661453bc01663e3a2ed9bfd7f57d7f0b99f.tar.xz
gnupg2-0b176661453bc01663e3a2ed9bfd7f57d7f0b99f.zip
Write status output, make verify work in server mode.
Diffstat (limited to 'sm/fingerprint.c')
-rw-r--r--sm/fingerprint.c23
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;
+}
+
+