From aab14f8efeaccdfcdf99479902e720aea5d3c9bc Mon Sep 17 00:00:00 2001 From: ueno Date: Sat, 5 May 2001 22:47:49 +0000 Subject: [PATCH] * mime-edit.el (mime-edit-sign-smime): Use OpenSSL output as it is. (mime-edit-encrypt-smime): Ditto. * semi-setup.el: Revive setting for application/x-pkcs7-signature. --- mime-edit.el | 34 +++++++++++++--------------------- semi-setup.el | 6 ++++++ 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/mime-edit.el b/mime-edit.el index 3ee1983..428ded0 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -1823,26 +1823,15 @@ Content-Transfer-Encoding: 7bit (while (progn (end-of-line) (not (eobp))) (insert "\r") (forward-line 1)) - (or (prog1 (smime-sign-buffer) - (push nil buffer-undo-list) - (ignore-errors (undo))) + (or (smime-sign-buffer) (throw 'mime-edit-error 'pgp-error))) (goto-char beg) - (insert (format "--[[multipart/signed; - boundary=\"%s\"; micalg=sha1; - protocol=\"application/pkcs7-signature\"][7bit]] ---%s -" smime-boundary smime-boundary)) - (goto-char (point-max)) - (insert (format "\n--%s -Content-Type: application/pkcs7-signature; name=\"smime.p7s\" -Content-Transfer-Encoding: base64 -Content-Disposition: attachment; filename=\"smime.p7s\" -Content-Description: S/MIME Cryptographic Signature - -" smime-boundary)) - (goto-char (point-max)) - (insert (format "\n--%s--\n" smime-boundary)))))) + (if (re-search-forward "^Content-Type:\\s-*" nil t) + (let* ((start (match-beginning 0)) + (body (buffer-substring (match-end 0) (std11-field-end)))) + (delete-region start (line-beginning-position 2)) + (goto-char beg) + (insert "--[[" body "][7bit]]\n"))))))) (defun mime-edit-encrypt-smime (beg end boundary) (save-excursion @@ -1864,9 +1853,12 @@ Content-Description: S/MIME Cryptographic Signature (or (smime-encrypt-buffer) (throw 'mime-edit-error 'pgp-error)) (goto-char beg) - (insert "--[[application/pkcs7-mime; name=\"smime.p7m\" -Content-Disposition: attachment; filename=\"smime.p7m\" -Content-Description: S/MIME Encrypted Message][base64]]\n"))))) + (if (re-search-forward "^Content-Type:\\s-*" nil t) + (let* ((start (match-beginning 0)) + (body (buffer-substring (match-end 0) (std11-field-end)))) + (delete-region start (line-beginning-position 2)) + (goto-char beg) + (insert "--[[" body "]]\n"))))))) (defsubst replace-space-with-underline (str) (mapconcat (function diff --git a/semi-setup.el b/semi-setup.el index 5c9c82e..013d933 100644 --- a/semi-setup.el +++ b/semi-setup.el @@ -145,6 +145,12 @@ it is used as hook to set." 'action '((type . application)(subtype . pkcs7-mime) (method . mime-view-application/pkcs7-mime)) + 'strict "mime-pgp") + + (mime-add-condition + 'action + '((type . application)(subtype . x-pkcs7-mime) + (method . mime-view-application/pkcs7-mime)) 'strict "mime-pgp")))) -- 1.7.10.4