-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No indication of failed encryption #12
Comments
Please try the below code. You would be asked whether proceed when no available key is found for recipient. Or, set (defun mime-edit-encrypt-pgp-mime (beg end boundary)
(save-excursion
(save-restriction
(let* ((ret (mime-edit-make-encrypt-recipient-header))
(recipients (car ret))
(header (cdr ret)))
(narrow-to-region beg end)
(let* ((ret
(mime-edit-translate-region beg end boundary))
(ctype (car ret))
(encoding (nth 1 ret))
(pgp-boundary (concat "pgp-" boundary))
(context (epg-make-context))
cipher)
(goto-char beg)
(insert header)
(insert (format "Content-Type: %s\n" ctype))
(if encoding
(insert (format "Content-Transfer-Encoding: %s\n" encoding))
)
(insert "\n")
(mime-encode-header-in-buffer)
(epg-context-set-armor context t)
(if mime-edit-pgp-verbose
(setq recipients
(epa-select-keys context "\
Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. "
recipients))
(setq recipients
(delq
nil (mapcar
(lambda (name)
(or (mime-edit-pgp-keys-valid-key
(epg-list-keys context name) 'encrypt)
(unless
(y-or-n-p
(format
"No available key for %s, proceed? " name))
(signal 'epg-error '(quit)))))
recipients))))
(setq cipher
(epg-encrypt-string
context
(buffer-substring (point-min) (point-max))
recipients))
(delete-region (point-min)(point-max))
(goto-char beg)
(insert (format "--[[multipart/encrypted;
boundary=\"%s\";
protocol=\"application/pgp-encrypted\"][7bit]]
--%s
Content-Type: application/pgp-encrypted
Version: 1
--%s
Content-Type: application/octet-stream
Content-Transfer-Encoding: 7bit
" pgp-boundary pgp-boundary pgp-boundary))
(insert cipher)
(goto-char (point-max))
(insert (format "\n--%s--\n" pgp-boundary))
))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Semi doesn't warn when attempting to encrypt to an address with no available key -- it just encrypts to self and sends the mail.
To reproduce:
and the mail goes out.
The text was updated successfully, but these errors were encountered: