...
 
Commits (3)
......@@ -77,9 +77,12 @@
;; - Adapted for Emacs 25.1.
;; 2018/12/27, Version 4.4.
;; - New variable mml-secure-use-unusable-pgp-keys.
;; Cause error if your message cannot be encrypted because only
;; Raise error if your message cannot be encrypted because only
;; unusable (expired or revoked) keys exist. Prevents plaintext
;; when newer keys might be available.
;; when newer keys might be available. For this to work, you need
;; to answer "n" when you are asked whether to skip recipients for
;; which "no encrypt key" is found.
;; - Fix code not to insert sign tags unconditionally.
;;
;; Compatibility: GNU Emacs 25.1
......@@ -213,7 +216,8 @@
(add-hook 'message-send-hook 'mml-secure-check-encryption-p)
(defgroup jl-encrypt nil
"Customization options for jl-encrypt.el.")
"Customization options for jl-encrypt.el."
:group 'mail)
(defcustom mml-secure-use-unusable-pgp-keys t
"Control whether also unusable keys should lead to questions.
......@@ -362,24 +366,37 @@ no secure sign tag is present."
(defun mml-secure-encrypt-if-possible ()
"Insert MML security tag if appropriate.
This function may insert MML tags for signing and/or encryption.
Creation of sign tags is controlled by `mml-secure-insert-signature'. If
that variable is `always', a sign tag for method `mml-default-sign-method'
is created.
Moreover, the creation of an encrypt tag is determined based on the existence
of public keys for all recipients of the current message, see
Creation of sign tags is controlled by `mml-secure-insert-signature'
and potentially preexisting security tags (such as those added by
`gnus-message-replyencrypt'). If `mml-secure-insert-signature' is
non-nil, for a message without sign tag, a sign or signencrypt tag for
method `mml-default-sign-method' is created.
Moreover, the creation of an encrypt tag is determined based on the
existence of public keys for all recipients of the current message, see
`mml-secure-maybe-add-tag'. If an encrypt tag is added, the message will
additionally be signed if `mml-secure-insert-signature' is `encrypted'."
(if (not mml-secure-insert-signature)
(setq gnus-message-replysignencrypted nil)
(if (eq 'always mml-secure-insert-signature)
(mml-secure-message mml-default-sign-method 'sign)))
(mml-secure-maybe-add-tag t))
;; Insert a signature tag if not present already.
(unless (mml-secure-is-signed-p)
(if (mml-secure-is-encrypted-p)
;; The message is tagged to be encrypted already, so the
;; precise value of mml-secure-insert-signature does not
;; matter here. Insert signencrypt tag.
(mml-secure-message mml-default-sign-method 'signencrypt)
(if (eq 'always mml-secure-insert-signature)
;; Insert a signature tag.
;; An encrypt tag might be added if keys are available.
(mml-secure-message mml-default-sign-method 'sign)))))
(unless (mml-secure-is-encrypted-p)
;; Only try to add tags if not tagged for encryption already.
(mml-secure-maybe-add-tag t)))
(defun mml-secure-maybe-add-tag-for-args (recipients method &optional dontask)
"Maybe add MML secure tag for RECIPIENTS and METHOD.
If keys are available for all RECIPIENTS and METHOD and DONTASK is
nil, ask whether no encryption should be performed. If the user
answers \"yes\",don't add an MML tag and return `yes'; if the user
answers \"yes\", don't add an MML tag and return `yes'; if the user
answers \"no\", insert tag and return `no'.
Otherwise, if DONTASK is t, insert tag and return 'inserted.
Otherwise, return `failed'."
......