Re: [twmode-users] 認証済みaccess tok enの保存に対応しました

2011-01-09 スレッド表示 fubabz
佐久間です。
対応ありがとうございました。
LinuxおよびWindowsのGNU Emacs 23/24で確認しました。
-- 
sakuma

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users


Re: [twmode-users] 認証済みaccess tok enの保存に対応しました

2011-01-08 スレッド表示 Tadashi MATSUO
松尾です。

> gpg -d は途中で復号化が失敗した旨のメッセージが出ていたようです。

そうでしたか。それなら納得です。

> epg-encrypt-stringの結果はバイナリじゃないでしょうか。
> この理解が正しいとすると変換されてしまうのは改行コードというより文字コードだと思います。
> これはOSには依存せず、Unixでも同じです。Linux上で問題がおきないのはなぜか、私にもわかりません。

epg-encrypt-stringの結果はバイナリ(unibyte string)です。
なので文字コードの自動認識で特定文字コードと誤認識される
可能性はむしろ低いと思います。

改行コードならLFが0x0A、CRが0x0Dで、暗号化後のバイナリに現れる
可能性は十分あります。恐らくepg-encrypt-string中にLFがあって、
それがWindows用にCRLF(0x0D 0x0A)に変換されてしまっていたのでしょう。

Emacs23(Cygwin)でのcoding-system SJISの属性では
EOL type: Automatic selection from:
  [japanese-shift-jis-unix japanese-shift-jis-dos japanese-shift-jis-mac]
となってました。これのdosが選択されたんじゃないでしょうか。


> パッチはLinuxでは試していませんので、commit前の確認をお願いしたいです。

Linux上でEmacs23を使える環境はないのでCygwinのEmacs23でEasyPGを
使って試してみましたが問題ありませんでした。他の環境でも
問題ないでしょう。

> また、当方は EasyPG の部分しか調べておりませんので、alpaca についても確認いただければと思います。

alpacaの方では暗号化前のデータを入れた一時ファイルを作って
それをgpgで変換しているので暗号化時にEmacsとgpgの間でバイナリ
のやりとりがありません。なので改行が変換されても復号できなく
なることはありませんが、一応暗号化対象のbyte列を完全に保つ
という意味で同様の対処をしておきました。

> > commitしたいのですが、ChangeLog上のお名前はSakumaで良いで
> > しょうか。
> 
> はい結構です。

了解です。commitしました。ご確認ください。

---
松尾 直志 

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users


Re: [twmode-users] 認証済みaccess tok enの保存に対応しました

2011-01-08 スレッド表示 fubabz
佐久間です。

2011/1/8 Tadashi MATSUO :
> 書き込むのは(epg-encrypt-string context str nil)で生成した
> (恐らくunibyteの)文字列なので、明示的にno-conversionにして
> おいた方が良さそうですね。
> commitしたいのですが、ChangeLog上のお名前はSakumaで良いで
> しょうか。

はい結構です。

> Twitter上でお聞きした話のときはgpg -dで復号できるがその結果が
> おかしい、ということでしたよね。Windowsだから改行関係の変換
> (LF←→CRLF)が入って、しかもたまたまGnuPGでも(エラーなしに)
> 復号できるデータになってたということだったんでしょうか…。

tweet時の発言は信じないでください(笑)。自分もわけがわからず安直に.emacsをいじって解決しようとしていたので…

gpg -d は途中で復号化が失敗した旨のメッセージが出ていたようです。

epg-encrypt-stringの結果はバイナリじゃないでしょうか。
この理解が正しいとすると変換されてしまうのは改行コードというより文字コードだと思います。
これはOSには依存せず、Unixでも同じです。Linux上で問題がおきないのはなぜか、私にもわかりません。
パッチはLinuxでは試していませんので、commit前の確認をお願いしたいです。

twittering-write-and-encrypt で呼んでいる with-temp-buffer は実際はwrite-region
で書き出していますので、変換関連は write-region のdocstring を参考にしてください。

私の.emacsでは明示的に coding-system を設定(SJIS)していたので、変換されてしまった可能性があります。

また、当方は EasyPG の部分しか調べておりませんので、alpaca についても確認いただければと思います。
-- 
sakuma

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users


Re: [twmode-users] 認証済みaccess tok enの保存に対応しました

2011-01-08 スレッド表示 Tsuyoshi CHO
ども、長です。

# 最近ぜんぜん触れてないorz

思いついただけですが、一言

(2011/01/08 21:03), Tadashi MATSUO wrote:
> 松尾です。
> 
> パッチありがとうございます。見させてもらいました。

> しかしここで何かしらの変換が入るとは思ってませんでした。
> 
> Twitter上でお聞きした話のときはgpg -dで復号できるがその結果が
> おかしい、ということでしたよね。Windowsだから改行関係の変換
> (LF←→CRLF)が入って、しかもたまたまGnuPGでも(エラーなしに)
> 復号できるデータになってたということだったんでしょうか…。

さすがにそれはなさそうです、よね...。

なんとなくですが、検証時と佐久間さんの環境でGnuPGが違うんじゃないかなと。

WindowsネイティブとCygwin版とかだったのかなとか想像しますが...
# あとはgpg.confの設定とか? 1.x系と2.x系の違いという可能性はあるかな...?

なんにせよ変換が入らないようにしたほうがいいでしょうね。

というか、文字として扱うよりはバイト列にして管理しちゃうほうがいいんじゃ
ないか、という気がしないでもないです。

# Human-Readableであることが重要ではなく、データ列の整合性が重要ですし

いじょ

-- 
Tsuyoshi CHO

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users


Re: [twmode-users] 認証済みaccess tok enの保存に対応しました

2011-01-08 スレッド表示 Tadashi MATSUO
松尾です。

パッチありがとうございます。見させてもらいました。

diff --git a/twittering-mode.el b/twittering-mode.el
index 8fc2ef4..d82ff12 100644
--- a/twittering-mode.el
+++ b/twittering-mode.el
@@ -2659,7 +2659,8 @@ like following:
  ;; In order to prevent `epa-file' to encrypt the file double,
  ;; `epa-file-name-regexp' is temorarily changed into the null
  ;; regexp that never matches any string.
- (let ((epa-file-name-regexp "\\`\\'"))
+ (let ((epa-file-name-regexp "\\`\\'")
+   (coding-system-for-write 'no-conversion))
(when (fboundp 'epa-file-name-regexp-update)
  (epa-file-name-regexp-update))
(with-temp-file file

書き込むのは(epg-encrypt-string context str nil)で生成した
(恐らくunibyteの)文字列なので、明示的にno-conversionにして
おいた方が良さそうですね。
commitしたいのですが、ChangeLog上のお名前はSakumaで良いで
しょうか。


しかしここで何かしらの変換が入るとは思ってませんでした。

Twitter上でお聞きした話のときはgpg -dで復号できるがその結果が
おかしい、ということでしたよね。Windowsだから改行関係の変換
(LF←→CRLF)が入って、しかもたまたまGnuPGでも(エラーなしに)
復号できるデータになってたということだったんでしょうか…。

---
松尾 直志 

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users


Re: [twmode-users] 認証済みaccess tok enの保存に対応しました

2011-01-08 スレッド表示 fubabz
佐久間です。

環境:
MS WindowsXP SP3
GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1

で、当方の.emacsが絡むと暗号化の際アクセストークンが壊れる(gpg -dで復号化できない)現象が生じました(emacs -qだと正常に暗号化されます)。

twittering-mode.el
を調べ、添付のパッチを当てたら現象が出なくなりましたが、他のLinux環境ではパッチなしでも問題ないので、修正が妥当なのかどうか判断できません。パッチの是非を確認いただけないでしょうか?

よろしくお願いします。
-- 
sakuma


pa
Description: Binary data
--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl ___
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users