Gnus development mailing list
 help / color / mirror / Atom feed
From: Daiki Ueno <ueno@unixuser.org>
To: Ted Zlatanov <tzz@lifelogs.com>
Cc: ding@gnus.org,  tramp-devel@mail.freesoftware.fsf.org
Subject: Re: file storage in IMAP (eventually for Tramp) working and needs testing
Date: Thu, 23 Apr 2009 23:28:08 +0900	[thread overview]
Message-ID: <46c9c7d6-ae70-41f0-a8dd-b2eea679588b@broken.deisui.org> (raw)
In-Reply-To: <7d371a60-fbac-4b0e-a6b3-2001292f0205@broken.deisui.org> (Daiki Ueno's message of "Thu, 23 Apr 2009 22:48:39 +0900")

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

>>>>> In <7d371a60-fbac-4b0e-a6b3-2001292f0205@broken.deisui.org> 
>>>>>	Daiki Ueno <ueno@unixuser.org> wrote:
> >>>>> In <86zle7a3in.fsf@lifelogs.com> 
> >>>>>	Ted Zlatanov <tzz@lifelogs.com> wrote:
> > If you trust your 3 servers, that's great.  The vast majority of IMAP
> > users, as I said, have no expectation of privacy on their IMAP server
> > (consider GMail, for instance).  This is not a filesystem on a remote
> > server where you can trust user permissions to be managed correctly.

> I agree with the facts.  But in that case, you cannot even trust your
> ISP which delivers original e-mails, can you?

Ah, I see my confusion about e-mail systems and IMAP as a file system.
That makes sense.  I apologize to you for that.

But still, I'm against the use of PGG (which is on the way to
obsolescence) in the new package.  Here is a patch to use EPG instead.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tramp-imap.el.diff --]
[-- Type: text/x-diff, Size: 2840 bytes --]

--- tramp-imap.el~	2009-04-23 23:13:51.000000000 +0900
+++ tramp-imap.el	2009-04-23 23:25:46.000000000 +0900
@@ -247,7 +247,7 @@
 (require 'tramp-cache)
 (require 'tramp-compat)
 (require 'imap)
-(require 'pgg)
+(require 'epa)
 (autoload 'auth-source-user-or-password "auth-source")
 
 ;; Define Tramp IMAP method ...
@@ -627,8 +627,7 @@
       (goto-char (point-min))
       (while (re-search-forward "
" nil t)
 	(replace-match "" nil nil))
-      ;; TODO: catch errors from PGG here
-      (tramp-imap-pgg-decode-buffer))))
+      (tramp-imap-decode-buffer))))
 
 ;;; (tramp-imap-collapse-name "a b c / where ; strange ! characters $ abound") 
 ;;; => "abcwherestrangecharactersabound"
@@ -655,29 +654,40 @@
 		(with-current-buffer filename-or-buffer
 		  (buffer-string)))
 	     (insert-file-contents filename-or-buffer))
-	   (tramp-imap-pgg-encode-buffer))))
+	   (tramp-imap-encode-buffer))))
       (current-buffer)))
 
-(defun tramp-imap-pgg-encode-buffer ()
-  (tramp-imap-pgg-process-buffer t))
-
-(defun tramp-imap-pgg-decode-buffer ()
-  (tramp-imap-pgg-process-buffer))
-
-(defun tramp-imap-pgg-process-buffer (&optional encode)
-  "Use PGG to encode or decode the current buffer."
-  (let ((pfft (if encode 'pgg-encrypt-symmetric 'pgg-decrypt))
-	(default-enable-multibyte-characters nil)
-	(input (buffer-substring-no-properties (point-min) (point-max)))
-	exit-data)
-    (with-temp-buffer
-      (insert input)
-      ;; note that we call pfft before pgg-display-output-buffer
-      (pgg-display-output-buffer (point-min) (point-max) (funcall pfft (point-min) (point-max) tramp-imap-passphrase))
-      (setq exit-data
-	    (buffer-substring-no-properties (point-min) (point-max))))
-;    (debug exit-data)
-    exit-data))
+(defun tramp-imap-encode-buffer ()
+  (let ((context (epg-make-context 'OpenPGP))
+	cipher)
+    (epg-context-set-armor context t)
+    (epg-context-set-passphrase-callback context
+					 #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+				       (cons #'epa-progress-callback-function
+					     "Encrypting..."))
+    (message "Encrypting...")
+    (setq cipher (epg-encrypt-string
+		  context
+		  (encode-coding-string (buffer-string) 'utf-8)
+		  nil))
+    (message "Encrypting...done")
+    cipher))
+
+(defun tramp-imap-decode-buffer ()
+  (let ((context (epg-make-context 'OpenPGP))
+	plain)
+    (epg-context-set-passphrase-callback context
+					 #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+				       (cons #'epa-progress-callback-function
+					     "Decrypting..."))
+    (message "Decrypting...")
+    (setq plain (decode-coding-string
+		 (epg-decrypt-string context (buffer-string))
+		 'utf-8))
+    (message "Decrypting...done")
+    plain))
 
 (provide 'tramp-imap)
 ;;; tramp-imap.el ends here

[-- Attachment #3: Type: text/plain, Size: 25 bytes --]


Regards,
-- 
Daiki Ueno

  parent reply	other threads:[~2009-04-23 14:28 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-26 20:02 Ted Zlatanov
2007-12-29 22:34 ` David
2007-12-30 20:35   ` Ted Zlatanov
2007-12-31 10:14     ` Michael Albinus
2007-12-31 12:30       ` Ted Zlatanov
2007-12-31 13:35         ` Michael Albinus
2007-12-31 14:52           ` Ted Zlatanov
2007-12-31 17:14             ` Michael Albinus
2007-12-31 17:45               ` Ted Zlatanov
2007-12-31 21:32                 ` Michael Albinus
2008-01-02 20:43                   ` Ted Zlatanov
2008-01-02 21:40                     ` Reiner Steib
2008-01-02 22:15                       ` Ted Zlatanov
2008-01-02 23:50                     ` Michael Albinus
2008-01-03 11:32                       ` Reiner Steib
2008-01-03 12:43                         ` Ted Zlatanov
2008-01-03 12:56                           ` Michael Albinus
2008-01-03 13:21                       ` Ted Zlatanov
2008-01-03 13:27                         ` Ted Zlatanov
2008-01-03 17:31                         ` James Cloos
2008-01-03 17:42                           ` Ted Zlatanov
2008-01-04 11:00                         ` Michael Albinus
2007-12-31 17:09     ` David
2009-04-12 13:04 ` Magnus Henoch
2009-04-13 15:50   ` Ted Zlatanov
2009-04-14  8:44     ` Michael Albinus
2009-04-14 16:22       ` Ted Zlatanov
2009-04-15 21:03         ` Michael Albinus
2009-04-23  0:15           ` Ted Zlatanov
2009-04-23  2:45             ` Daiki Ueno
2009-04-23 12:51               ` Ted Zlatanov
2009-04-23 13:09                 ` Daiki Ueno
2009-04-23 13:44                   ` Ted Zlatanov
2009-04-23 13:48                     ` Daiki Ueno
2009-04-23 14:19                       ` Ted Zlatanov
2009-04-23 14:28                       ` Daiki Ueno [this message]
2009-04-23 15:16                         ` Ted Zlatanov
2009-04-24  0:37                           ` Daiki Ueno
2009-04-23 21:30             ` Ted Zlatanov
2009-04-25 17:25               ` Michael Albinus
2009-07-10 21:34                 ` Ted Zlatanov
2009-07-15 21:25                   ` Tramp-IMAP works " Ted Zlatanov
2009-07-16  6:42                     ` Michael Albinus
2009-07-18 11:11                     ` Michael Albinus
2009-09-07  4:13                       ` Ted Zlatanov
2009-09-08 13:33                         ` Michael Albinus
2009-09-09 16:13                           ` Ted Zlatanov
2009-09-10  7:18                             ` Michael Albinus
2009-09-21 19:28                           ` imap-hash.el and tramp-imap.el Ted Zlatanov
2009-09-22 14:52                             ` Michael Albinus
2009-09-23 21:07                               ` Ted Zlatanov
2009-09-24 10:38                                 ` Michael Albinus
2009-09-25 20:48                                   ` Ted Zlatanov
2009-09-27 15:57                                     ` Ted Zlatanov
2009-09-27 19:24                                       ` Michael Albinus
2009-09-28 12:03                                         ` Michael Albinus
2009-09-24  6:44                             ` Reiner Steib
2009-09-25 20:49                               ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46c9c7d6-ae70-41f0-a8dd-b2eea679588b@broken.deisui.org \
    --to=ueno@unixuser.org \
    --cc=ding@gnus.org \
    --cc=tramp-devel@mail.freesoftware.fsf.org \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).