Function: mml2015-mailcrypt-sign
mml2015-mailcrypt-sign is a byte-compiled function defined in
mml2015.el.gz.
Signature
(mml2015-mailcrypt-sign CONT)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/mml2015.el.gz
(defun mml2015-mailcrypt-sign (cont)
(mc-sign-generic (message-options-get 'message-sender)
nil nil nil nil)
(let ((boundary (mml-compute-boundary cont))
hash point)
(goto-char (point-min))
(unless (re-search-forward "^-----BEGIN PGP SIGNED MESSAGE-----\r?$" nil t)
(error "Cannot find signed begin line"))
(goto-char (match-beginning 0))
(forward-line 1)
(unless (looking-at "Hash:[ \t]*\\([a-zA-Z0-9]+\\)")
(error "Cannot not find PGP hash"))
(setq hash (match-string 1))
(unless (re-search-forward "^$" nil t)
(error "Cannot not find PGP message"))
(forward-line 1)
(delete-region (point-min) (point))
(insert (format "Content-Type: multipart/signed; boundary=\"%s\";\n"
boundary))
(insert (format "\tmicalg=pgp-%s; protocol=\"application/pgp-signature\"\n"
(downcase hash)))
(insert (format "\n--%s\n" boundary))
(setq point (point))
(goto-char (point-max))
(unless (re-search-backward "^-----END PGP SIGNATURE-----\r?$" nil t)
(error "Cannot find signature part"))
(replace-match "-----END PGP MESSAGE-----" t t)
(goto-char (match-beginning 0))
(unless (re-search-backward "^-----BEGIN PGP SIGNATURE-----\r?$"
nil t)
(error "Cannot find signature part"))
(replace-match "-----BEGIN PGP MESSAGE-----" t t)
(goto-char (match-beginning 0))
(save-restriction
(narrow-to-region point (point))
(goto-char point)
(while (re-search-forward "^- -" nil t)
(replace-match "-" t t))
(goto-char (point-max)))
(insert (format "--%s\n" boundary))
(insert "Content-Type: application/pgp-signature\n\n")
(goto-char (point-max))
(insert (format "--%s--\n" boundary))
(goto-char (point-max))))