332 |
KEYFILE should contain a PEM encoded key and certificate." |
KEYFILE should contain a PEM encoded key and certificate." |
333 |
(interactive) |
(interactive) |
334 |
(with-current-buffer (or buffer (current-buffer)) |
(with-current-buffer (or buffer (current-buffer)) |
335 |
(smime-sign-region |
(unless (smime-sign-region |
336 |
(point-min) (point-max) |
(point-min) (point-max) |
337 |
(if keyfile |
(if keyfile |
338 |
keyfile |
keyfile |
339 |
(smime-get-key-with-certs-by-email |
(smime-get-key-with-certs-by-email |
340 |
(completing-read |
(completing-read |
341 |
(concat "Sign using which key? " |
(concat "Sign using which key? " |
342 |
(if smime-keys (concat "(default " (caar smime-keys) ") ") |
(if smime-keys (concat "(default " (caar smime-keys) ") ") |
343 |
"")) |
"")) |
344 |
smime-keys nil nil (car-safe (car-safe smime-keys)))))))) |
smime-keys nil nil (car-safe (car-safe smime-keys)))))) |
345 |
|
(error "Signing failed")))) |
346 |
|
|
347 |
(defun smime-encrypt-buffer (&optional certfiles buffer) |
(defun smime-encrypt-buffer (&optional certfiles buffer) |
348 |
"S/MIME encrypt BUFFER for recipients specified in CERTFILES. |
"S/MIME encrypt BUFFER for recipients specified in CERTFILES. |
351 |
nil." |
nil." |
352 |
(interactive) |
(interactive) |
353 |
(with-current-buffer (or buffer (current-buffer)) |
(with-current-buffer (or buffer (current-buffer)) |
354 |
(smime-encrypt-region |
(unless (smime-encrypt-region |
355 |
(point-min) (point-max) |
(point-min) (point-max) |
356 |
(or certfiles |
(or certfiles |
357 |
(list (read-file-name "Recipient's S/MIME certificate: " |
(list (read-file-name "Recipient's S/MIME certificate: " |
358 |
smime-certificate-directory nil)))))) |
smime-certificate-directory nil)))) |
359 |
|
(error "Encryption failed")))) |
360 |
|
|
361 |
;; Verify+decrypt region |
;; Verify+decrypt region |
362 |
|
|