(defun mm-view-pkcs7-verify (handle)
(let ((verified nil))
- (with-temp-buffer
- (insert "MIME-Version: 1.0\n")
- (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
- (insert-buffer-substring (mm-handle-buffer handle))
- (setq verified (smime-verify-region (point-min) (point-max))))
- (if verified
- (insert verified)
- (insert-buffer-substring smime-details-buffer)))
- t)
+ (if (eq mml-smime-use 'epg)
+ ;; Use EPG/gpgsm
+ (insert
+ (with-temp-buffer
+ (insert-buffer-substring (mm-handle-buffer handle))
+ (goto-char (point-min))
+ (let ((part (base64-decode-string (buffer-string))))
+ (epg-verify-string (epg-make-context 'CMS) part))))
+ (with-temp-buffer
+ (insert "MIME-Version: 1.0\n")
+ (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
+ (insert-buffer-substring (mm-handle-buffer handle))
+ (setq verified (smime-verify-region (point-min) (point-max))))
+ (if verified
+ (insert verified)
+ (insert-buffer-substring smime-details-buffer)))
+ t))
(autoload 'epg-decrypt-string "epg")