The "key_id" field seems to used for userid in gmime-3.0, while the
keyid is dropped in the fingerprint field if the full fingerprint is
not available.
}
}
} else if (certificate) {
- const char *key_id = g_mime_certificate_get_key_id (certificate);
+ const char *key_id = g_mime_certificate_get_fpr16 (certificate);
if (key_id) {
sp->map_key (sp, "keyid");
sp->string (sp, key_id);
#include "gmime-extra.h"
+#include <string.h>
GMimeStream *
g_mime_stream_stdout_new()
#else /* GMime >= 3.0 */
+const char*
+g_mime_certificate_get_fpr16 (GMimeCertificate *cert) {
+ const char *fpr = g_mime_certificate_get_fingerprint (cert);
+ if (!fpr || strlen (fpr) < 16)
+ return fpr;
+
+ return fpr + (strlen (fpr) - 16);
+}
+
char *
g_mime_message_get_address_string (GMimeMessage *message, GMimeAddressType type)
{
#define GMIME_ADDRESS_TYPE_BCC GMIME_RECIPIENT_TYPE_BCC
#define g_mime_2_6_unref(obj) g_object_unref (obj)
+#define g_mime_certificate_get_fpr16(cert) g_mime_certificate_get_key_id (cert)
#else /* GMime >= 3.0 */
typedef GMimeAddressType GMimeRecipientType;
#define g_mime_2_6_unref(obj) /*ignore*/
#endif
+/**
+ * Get last 16 hex digits of fingerprint ("keyid")
+ */
+const char *g_mime_certificate_get_fpr16 (GMimeCertificate *cert);
/**
* Return the contents of the appropriate address header as a string
* Should be freed using g_free