* mml2015.el (mml2015-epg-passphrase-callback): Display key ID on the passphrase...
[gnus] / lisp / mml2015.el
index 0e55012..5429a27 100644 (file)
@@ -131,11 +131,16 @@ Whether the passphrase is cached at all is controlled by
   :group 'mime-security
   :type '(repeat (string :tag "Key ID")))
 
-(defcustom mml2015-encrypt-to-self nil
+(defcustom mml2015-encrypt-to-self t
   "If t, add your own key ID to recipient list when encryption."
   :group 'mime-security
   :type 'boolean)
 
+(defcustom mml2015-always-trust t
+  "If t, GnuPG skip key validation on encryption."
+  :group 'mime-security
+  :type 'boolean)
+
 ;;; mailcrypt wrapper
 
 (eval-and-compile
@@ -951,16 +956,14 @@ Whether the passphrase is cached at all is controlled by
 (defun mml2015-epg-passphrase-callback (context key-id ignore)
   (if (eq key-id 'SYM)
       (epg-passphrase-callback-function context key-id nil)
-    (let* ((entry (assoc key-id epg-user-id-alist))
+    (let* (entry
           (passphrase
            (password-read
-            (format "GnuPG passphrase for %s: "
-                    (if entry
-                        (cdr entry)
-                      key-id))
             (if (eq key-id 'PIN)
-                "PIN"
-              key-id))))
+                "Passphrase for PIN: "
+              (if (setq entry (assoc key-id epg-user-id-alist))
+                  (format "Passphrase for %s %s: " key-id (cdr entry))
+                (format "Passphrase for %s: " key-id))))))
       (when passphrase
        (let ((password-cache-expiry mml2015-passphrase-cache-expiry))
          (password-cache-add key-id passphrase))
@@ -1217,7 +1220,8 @@ If no one is selected, default secret key is used.  "
         #'mml2015-epg-passphrase-callback))
     (condition-case error
        (setq cipher
-             (epg-encrypt-string context (buffer-string) recipients sign)
+             (epg-encrypt-string context (buffer-string) recipients sign
+                                 mml2015-always-trust)
              mml2015-epg-secret-key-id-list nil)
       (error
        (while mml2015-epg-secret-key-id-list