- (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)
- (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,]+"))))
- (if (eq mm-encrypt-option 'guided)
- (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")))
- (message-options-set 'mml-smime-epg-recipients recipients))
- (if mml-smime-cache-passphrase
- (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)
- (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)))
- (signal (car error) (cdr error))))