[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tracing of SMTP session?
Hi,
> Now it turns out that whenever I sign a message with an attachment
> (pdf file ~1.0MB base64 encoding) wanderlust hangs.
Wanderlust (SEMI-EPG, strictly) does not hangs but takes too much
time. Please try the below definition of mime-edit-sign-pgp-mime
function.
(defun mime-edit-sign-pgp-mime (beg end boundary)
(save-excursion
(save-restriction
(let* ((ret (let ((mime-transfer-level 7))
(narrow-to-region beg end)
(mime-edit-translate-region beg end boundary)))
(ctype (car ret))
(encoding (nth 1 ret))
(pgp-boundary (concat "pgp-sign-" boundary))
(context (epg-make-context))
index plain signature micalg)
(mime-edit-delete-trailing-whitespace) ; RFC3156
(goto-char beg)
(insert (format "Content-Type: %s\n" ctype))
(if encoding
(insert (format "Content-Transfer-Encoding: %s\n" encoding))
)
(insert "\n")
(epg-context-set-armor context t)
(epg-context-set-textmode context nil)
(epg-context-set-signers
context
(mime-edit-pgp-get-signers context))
(goto-char (point-min))
(setq index (point))
(while (re-search-forward "\r?\n" nil t)
(setq plain (cons "\r\n"
(cons (buffer-substring index (match-beginning 0))
plain))
index (match-end 0)))
(setq plain
(apply 'concat (nreverse
(cons (buffer-substring index (point-max))
plain))))
(setq signature (epg-sign-string context plain 'detached))
(setq micalg (epg-new-signature-digest-algorithm
(car (epg-context-result-for context 'sign))))
(goto-char beg)
(insert (format "
--%s
"
pgp-boundary
(if micalg
(concat "; micalg=pgp-"
(downcase
(cdr (assq micalg
epg-digest-algorithm-alist))))
"")
pgp-boundary))
(goto-char (point-max))
(insert (format "\n--%s
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
Content-Description: OpenPGP Digital Signature
" pgp-boundary))
(insert signature)
(goto-char (point-max))
(insert (format "\n--%s--\n" pgp-boundary))
))))
--
Kazuhiro Ito