1 ;;; tm-edit-tipgp.el -- TinyPgp.el PGP interface
3 ;; Copyright (C) 1996 Jari aalto
5 ;; Author: Jari Aalto <jari.aalto@poboxes.com>
6 ;; Version: $Id: tm-edit-tipgp.el,v 1.1 1996/12/04 11:11:47 jaalto Beta $
7 ;; Keywords: mail, news, MIME, multimedia, multilingual, security, PGP
9 ;; This file is part of tm (Tools for MIME).
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 (require 'tinypgpa.el)
30 (defun tm:tipgp-process-region (result-buffer boundary)
31 (let ((obuf (current-buffer))
35 (goto-char (point-min))
36 (insert (format "--%s\n" boundary))
37 (goto-char (point-max))
38 (insert (format "\n--%s
39 Content-Type: application/pgp-signature
40 Content-Transfer-Encoding: 7bit
43 (insert-buffer-substring result-buffer)
44 (goto-char (point-max))
45 (insert (format "\n--%s--\n" boundary))
48 (delete-region beg end)
50 (insert-buffer-substring result-buffer)
57 (defun tm:tipgp-sign-region (start end &optional id unclear boundary)
61 ;; boundary = pgp-sign-Multipart_Wed_Dec__4_11:14:41_1996-1
63 (let (tipgp-:xpgp-header-mode ;Do not use X-Pgp signing
68 (setq passwd (tipgp-password-get-old "Sign pass phrase: "))
71 ;; The region is already narrowed by TM, so we pass the
72 ;; point-min point-max
74 ;; The macro tipgp-run-in-tmp-buffer cpies the contents to
75 ;; another buffer and when signing is over, it will
76 ;; contain fully signed message
80 (tipgp-run-in-tmp-buffer nil
82 (point-min) (point-max) passwd 'verb
84 "+comment=\"Processed by TinyPgp.el %s\""
85 (strmatget "[0-9][0-9.]+" 0 tipgp-version-id)
91 (tm:tipgp-process-region tipgp-:buffer-tmp-copy boundary))
95 (goto-char (point-min))
98 --[[multipart/signed; protocol=\"application/pgp-signature\";
99 boundary=\"%s\"; micalg=pgp-md5][7bit]]\n" boundary))
106 (defun tm:tipgp-pgp-encrypt-region (recipients start end &optional id sign)
107 (let (;; do not use these hooks while in TM
109 tipgp-cmd-macro-before-hook
110 tipgp-cmd-macro-after-hook
112 ;; TinyPgp.el: has separate encrypt and signing functions.
114 ;;; (mc-pgp-always-sign
115 ;;; (if (eq sign 'maybe)
116 ;;; mc-pgp-always-sign
119 (elist (ti::mt-email-from-string recipients))
122 (error "TO,CC,BCC fields don't contain email addresses."))
123 (tipgp-encrypt-region (point-min) (point-max) elist nil 'verb)
130 (provide 'tm-edit-tipgp)
132 ;;; tm-edit-tipgp.el ends here