From: Uwe Brauer <oub@mat.ucm.es>
To: ding@gnus.org
Subject: Re: mml-smime: mml-sime-encrypt-to-self
Date: Tue, 08 Jan 2013 12:14:58 +0100 [thread overview]
Message-ID: <87ip78ylhp.fsf@gilgamesch.quim.ucm.es> (raw)
In-Reply-To: <87hamuioot.fsf@mat.ucm.es>
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
>> "Uwe" == Uwe Brauer <oub@mat.ucm.es> writes:
> Hello Mml2015 has the useful variable mml2015-encrypt-to-self
> but mml-smime has no equivalent.
> I had a look at the code and for me it is not obvious how
> include this functionality.
> Can somebody familiar with the code have a look please.
I think I have implemented it. I attach a patch, since I am not
familiar
with bzr.
Uwe Brauer
[-- Attachment #2: mml-smime-diff --]
[-- Type: application/octet-stream, Size: 4594 bytes --]
diff -u /home/oub/xemacs/site-lisp/packages/gnus-git-28-9-2011/lisp/mml-smime-git.el /home/oub/xemacs/site-lisp/packages/gnus-git-28-9-2011/lisp/mml-smime.el
--- /home/oub/xemacs/site-lisp/packages/gnus-git-28-9-2011/lisp/mml-smime-git.el 2013-01-08 11:31:07.882405203 +0100
+++ /home/oub/xemacs/site-lisp/packages/gnus-git-28-9-2011/lisp/mml-smime.el 2013-01-08 11:31:07.890405032 +0100
@@ -79,6 +79,12 @@
:group 'mime-security
:type 'boolean)
+
+(defcustom mml-smime-encrypt-to-self nil
+ "If t, add your own key ID to recipient list when encryption."
+ :group 'mime-security
+ :type 'boolean)
+
(defun mml-smime-sign (cont)
(let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist))))
(if func
@@ -474,59 +480,68 @@
(defun mml-smime-epg-encrypt (cont)
(let ((inhibit-redisplay t)
- (context (epg-make-context 'CMS))
- (config (epg-configuration))
- (recipients (message-options-get 'mml-smime-epg-recipients))
- cipher signers
- (boundary (mml-compute-boundary cont))
- recipient-key)
+ (context (epg-make-context 'CMS))
+ (config (epg-configuration))
+ (recipients (message-options-get 'mml-smime-epg-recipients))
+ cipher
+ (sender (message-options-get 'message-sender))
+ (signer-names (or mml-smime-signers
+ (if (and mml-smime-sign-with-sender sender)
+ (list (concat "<" sender ">")))))
+ signers
+ (boundary (mml-compute-boundary cont))
+ recipient-key)
(unless recipients
(setq recipients
- (apply #'nconc
- (mapcar
- (lambda (recipient)
- (or (epg-expand-group config recipient)
- (list recipient)))
- (split-string
- (or (message-options-get 'message-recipients)
- (message-options-set 'message-recipients
- (read-string "Recipients: ")))
- "[ \f\t\n\r\v,]+"))))
+ (apply #'nconc
+ (mapcar
+ (lambda (recipient)
+ (or (epg-expand-group config recipient)
+ (list recipient)))
+ (split-string
+ (or (message-options-get 'message-recipients)
+ (message-options-set 'message-recipients
+ (read-string "Recipients: ")))
+ "[ \f\t\n\r\v,]+"))))
+ (when mml-smime-encrypt-to-self
+ (unless signer-names
+ (error "Neither message sender nor mml-smime-signers are set"))
+ (setq recipients (nconc recipients signer-names)))
(if (eq mm-encrypt-option 'guided)
- (setq recipients
- (epa-select-keys context "\
+ (setq recipients
+ (epa-select-keys context "\
Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. "
- recipients))
- (setq recipients
- (mapcar
- (lambda (recipient)
- (setq recipient-key (mml-smime-epg-find-usable-key
- (epg-list-keys context recipient)
- 'encrypt))
- (unless (or recipient-key
- (y-or-n-p
- (format "No public key for %s; skip it? "
- recipient)))
- (error "No public key for %s" recipient))
- recipient-key)
- recipients))
- (unless recipients
- (error "No recipient specified")))
+ recipients))
+ (setq recipients
+ (mapcar
+ (lambda (recipient)
+ (setq recipient-key (mml-smime-epg-find-usable-key
+ (epg-list-keys context recipient)
+ 'encrypt))
+ (unless (or recipient-key
+ (y-or-n-p
+ (format "No public key for %s; skip it? "
+ recipient)))
+ (error "No public key for %s" recipient))
+ recipient-key)
+ recipients))
+ (unless recipients
+ (error "No recipient specified")))
(message-options-set 'mml-smime-epg-recipients recipients))
(if mml-smime-cache-passphrase
- (epg-context-set-passphrase-callback
- context
- #'mml-smime-epg-passphrase-callback))
+ (epg-context-set-passphrase-callback
+ context
+ #'mml-smime-epg-passphrase-callback))
(condition-case error
- (setq cipher
- (epg-encrypt-string context (buffer-string) recipients)
- mml-smime-epg-secret-key-id-list nil)
+ (setq cipher
+ (epg-encrypt-string context (buffer-string) recipients)
+ mml-smime-epg-secret-key-id-list nil)
(error
(while mml-smime-epg-secret-key-id-list
- (password-cache-remove (car mml-smime-epg-secret-key-id-list))
- (setq mml-smime-epg-secret-key-id-list
- (cdr mml-smime-epg-secret-key-id-list)))
+ (password-cache-remove (car mml-smime-epg-secret-key-id-list))
+ (setq mml-smime-epg-secret-key-id-list
+ (cdr mml-smime-epg-secret-key-id-list)))
(signal (car error) (cdr error))))
(delete-region (point-min) (point-max))
(goto-char (point-min))
next prev parent reply other threads:[~2013-01-08 11:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-06 10:35 Uwe Brauer
2013-01-08 11:14 ` Uwe Brauer [this message]
2013-01-10 9:08 ` Daiki Ueno
2013-01-10 11:16 ` Uwe Brauer
2013-01-11 17:36 ` Uwe Brauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ip78ylhp.fsf@gilgamesch.quim.ucm.es \
--to=oub@mat.ucm.es \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).