Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!pasteur!ucbvax!IFI.UIO.NO!obh From: obh@IFI.UIO.NO Newsgroups: comp.emacs Subject: Re: encrypting a buffer Message-ID: <8803232216.AA25993@skakke> Date: 23 Mar 88 22:16:55 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 52 Sorry to post this to the net; the mailer at seismo.CSS.GOV didn't quite understand the receviers address. > From: "Mark D. Grover" > > Has anyone implemented a DES interface to RMAIL or to a buffer in > general? I may want to encrypt mail for delivery through a network > (so 'xsend' is not the answer). I would like a M-x encrypt-buffer and > decrypt-buffer command (or, better, an RMAIL command that acts on the > message). The command would prompt for the key. I am using a Sun. > > Using "ESC | des" produces output that fails to decrypt. Any ideas? > (defun do-crypt-region (start end key) "runs des -e on the region and replace it's contents with des output" (interactive "r\nsEnter Key: ") (call-process-region start end "des" t t t ;;The arguments to the des program "-e" "-k" key)) (defun encrypt-mail (key) (interactive "sEnter Key: ") (save-excursion (goto-char (point-min)) (search-forward "\n--text follows this line--\n") (do-crypt-region (point) (point-max) key))) (defun do-decrypt-region (start end key) "runs des -e on the region and replace it's contents with des output" (interactive "r\nsEnter Key: ") (call-process-region start end "des" t t t ;;The arguments to the des program "-d" "-k" key)) (defun decrypt-mail (key) (interactive "sEnter Key: ") (save-excursion (goto-char (point-min)) (search-forward "\n--text follows this line--\n") (do-decrypt-region (point) (point-max) key))) This hack should do the right thing. I've not tested it thoroughly but it worked on this mail when I used the crypt program. (Hopefully I gave ``des'' the righ args) It's not a safe program, but your're safe from the postmasters ;-) Hope it works! Ole Bjoern Hessen (OBH) obh@ifi.uio.no