+(autoload 'gnus-create-image "gnus-ems")
+
+(defun mml2015-epg-key-image (key-id)
+ "Return the image of a key, if any"
+ (with-temp-buffer
+ (mm-set-buffer-multibyte nil)
+ (let* ((coding-system-for-write 'binary)
+ (coding-system-for-read 'binary)
+ (data (shell-command-to-string
+ (format "%s --list-options no-show-photos --attribute-fd 3 --list-keys %s 3>&1 >/dev/null 2>&1"
+ (shell-quote-argument epg-gpg-program) key-id))))
+ (when (> (length data) 0)
+ (insert (substring data 16))
+ (condition-case nil
+ (gnus-create-image (buffer-string) nil t)
+ (error))))))
+
+(autoload 'gnus-rescale-image "gnus-util")
+
+(defun mml2015-epg-key-image-to-string (key-id)
+ "Return a string with the image of a key, if any"
+ (let ((key-image (mml2015-epg-key-image key-id)))
+ (if (not key-image)
+ ""
+ (condition-case error
+ (let ((result " "))
+ (put-text-property
+ 1 2 'display
+ (gnus-rescale-image key-image
+ (cons mml2015-maximum-key-image-dimension
+ mml2015-maximum-key-image-dimension))
+ result)
+ result)
+ (error "")))))
+
+(defun mml2015-epg-signature-to-string (signature)
+ (concat (epg-signature-to-string signature)
+ (mml2015-epg-key-image-to-string (epg-signature-key-id signature))))
+
+(defun mml2015-epg-verify-result-to-string (verify-result)
+ (mapconcat #'mml2015-epg-signature-to-string verify-result "\n"))
+