<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="rss.css" type="text/css"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xml:lang="ja-JP">
	<channel rdf:about="http://diary.does.notwork.org/gotoyuzo/index.rdf">
	<title>AD-HOCKERY DIARY</title>
	<link>http://diary.does.notwork.org/gotoyuzo/</link>
	<description></description>
	<dc:creator>GOTOU Yuuzou</dc:creator>
	<dc:rights>Copyright 2008 GOTOU Yuuzou &lt;gotoyuzo@notwork.org&gt;, copyright of comments by respective authors</dc:rights>
	<items><rdf:Seq>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080810#c01"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080810#p01"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080721#c02"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080721#c01"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080721#p01"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080720#p03"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080720#p02"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080720#p01"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080721#p03"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080721#p02"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p04"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p03"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p02"/>
<rdf:li rdf:resource="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p01"/>
</rdf:Seq></items>
</channel>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080810#c01">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080810#c01</link>
<dc:date>2008-08-17T20:52:45+09:00</dc:date>
<title>2008-08-10のツッコミ[1] (なひ)</title>
<dc:creator>なひ</dc:creator>
<description>http://ola-bini.blogspot.com/2008/08/where-is-netssh-bug.html バグだ言われてるよ</description>
<content:encoded><![CDATA[<a href="http://ola-bini.blogspot.com/2008/08/where-is-netssh-bug.html">http://ola-bini.blogspot.com/2008/08/where-is-netssh-bug.html</a> バグだ言われてるよ]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080810#p01">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080810#p01</link>
<dc:date>2008-08-10T18:11:52+09:00</dc:date>
<title>[Rails] named_scope</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>Rails</dc:subject>
<description>諸橋さんの「named_scopeについてくわしく」を読んだ。途中のコードは斜め読み(11ページとか何やってんのかわかんない)だけど、えっとつまり、findとかに渡すパラメータをクロージャで持って回ってSQLを発行する直前に適用できるのがうれしい感じなのかな。</description>
<content:encoded><![CDATA[<h3>[Rails] named_scope</h3><p>諸橋さんの「<a href="http://d.hatena.ne.jp/moro/20080630/1214800838">named_scopeについてくわしく</a>」を読んだ。途中のコードは斜め読み(11ページとか何やってんのかわかんない)だけど、えっとつまり、findとかに渡すパラメータをクロージャで持って回ってSQLを発行する直前に適用できるのがうれしい感じなのかな。</p>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080721#c02">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080721#c02</link>
<dc:date>2008-07-21T12:43:36+09:00</dc:date>
<title>2008-07-21のツッコミ[2] (gotoyuzo)</title>
<dc:creator>gotoyuzo</dc:creator>
<description>おとなしくpReserved使っとけばいいじゃないのかなあ。実際やってることはそうなんだし。</description>
<content:encoded><![CDATA[おとなしくpReserved使っとけばいいじゃないのかなあ。実際やってることはそうなんだし。]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080721#c01">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080721#c01</link>
<dc:date>2008-07-21T11:58:03+09:00</dc:date>
<title>2008-07-21のツッコミ[1] (なひ)</title>
<dc:creator>なひ</dc:creator>
<description>#11はそういう（pReservedで止めといて後ろへ伸びる）拡張の繰り返しだからいいんじゃね? 言うなら「勝手すんな」であって。</description>
<content:encoded><![CDATA[#11はそういう（pReservedで止めといて後ろへ伸びる）拡張の繰り返しだからいいんじゃね? 言うなら「勝手すんな」であって。]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080721#p01">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080721#p01</link>
<dc:date>2008-07-21T07:13:37+09:00</dc:date>
<title>[PKI] NSSのSoftoken</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>PKI</dc:subject>
<description>PKCS #11を調べるついでに眺める。CK_C_INITIALIZE_ARGSにLibraryParametersというメンバが追加されているが、バイナリインターフェースのAPIで構造体のサイズが変わるような拡張を入れるのっていまいちなような。</description>
<content:encoded><![CDATA[<h3>[PKI] NSSのSoftoken</h3><p>PKCS #11を調べるついでに眺める。<a href="http://developer.mozilla.org/en/docs/PKCS11_Module_Specs#Parameter_Passing">CK_C_INITIALIZE_ARGSにLibraryParametersというメンバが追加されている</a>が、バイナリインターフェースのAPIで構造体のサイズが変わるような拡張を入れるのっていまいちなような。</p>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080720#p03">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080720#p03</link>
<dc:date>2008-07-21T06:56:30+09:00</dc:date>
<title>[DVD] CROSSROAD GUITAR FESTIVAL 2007</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>DVD</dc:subject>
<description>Jeff Beckを見てBlow by BlowとGuitar Shopを聴きなおした。仕事はたまっているが遊んでばっかりだな。</description>
<content:encoded><![CDATA[<h3>[DVD] CROSSROAD GUITAR FESTIVAL 2007</h3><p>Jeff Beckを見てBlow by BlowとGuitar Shopを聴きなおした。仕事はたまっているが遊んでばっかりだな。</p>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080720#p02">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080720#p02</link>
<dc:date>2008-07-21T06:56:30+09:00</dc:date>
<title>[DVD] STAR TREK THE NEXT GENERATION</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>DVD</dc:subject>
<description>同僚に借りてぼちぼち見てる。50枚組のまだ3枚目。先は長いぞ。</description>
<content:encoded><![CDATA[<h3>[DVD] STAR TREK THE NEXT GENERATION</h3><p>同僚に借りてぼちぼち見てる。50枚組のまだ3枚目。先は長いぞ。 </p>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080720#p01">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080720#p01</link>
<dc:date>2008-07-21T06:56:30+09:00</dc:date>
<title>カバン</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<description>ORTLIEBのSling-it Whitelineを見てたら欲しくなったので、適当な肩掛けのやつを探していたということもあって購入した。2年ほど使っているBOBLBE-EのBACK SCREENよりも、かさばらないし物を出し入れしやすい。防水なのもポイント高い。</description>
<content:encoded><![CDATA[<h3>カバン</h3><a href="http://www.ortlieb.com/_prod.php?lang=en&produkt=whiteline-slingit">
ORTLIEBのSling-it Whiteline</a>を見てたら欲しくなったので、適当な肩掛けのやつを探していたということもあって購入した。2年ほど使っている<a href="http://www.boblbee.co.jp/products/06BackScreen.php">BOBLBE-EのBACK SCREEN</a>よりも、かさばらないし物を出し入れしやすい。防水なのもポイント高い。]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080721#p03">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080721#p03</link>
<dc:date>2008-07-21T06:50:13+09:00</dc:date>
<title>[DVD] CROSSROAD GUITAR FESTIVAL 2007</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>DVD</dc:subject>
<description>Jeff Beckを見てBlow by BlowとGuitar Shopを聴きなおした。仕事はたまっているが遊んでばっかりだな。</description>
<content:encoded><![CDATA[<h3>[DVD] CROSSROAD GUITAR FESTIVAL 2007</h3><p>Jeff Beckを見てBlow by BlowとGuitar Shopを聴きなおした。仕事はたまっているが遊んでばっかりだな。</p>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080721#p02">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080721#p02</link>
<dc:date>2008-07-21T06:42:39+09:00</dc:date>
<title>[DVD] STAR TREK THE NEXT GENERATION</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>DVD</dc:subject>
<description>同僚に借りてぼちぼち見てる。50枚組のまだ3枚目。先は長いぞ。</description>
<content:encoded><![CDATA[<h3>[DVD] STAR TREK THE NEXT GENERATION</h3><p>同僚に借りてぼちぼち見てる。50枚組のまだ3枚目。先は長いぞ。 </p>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p04">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080126#p04</link>
<dc:date>2008-07-14T09:55:10+09:00</dc:date>
<title>追記: この時書いたMETA-..</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<description>追記: この時書いたMETA-INFの検証をするプログラムを貼っとく。→jar_signer.rb</description>
<content:encoded><![CDATA[<p> 追記: この時書いたMETA-INFの検証をするプログラムを貼っとく。→<a href="http://www.does.notwork.org/~gotoyuzo/src/jar_signer.rb">jar_signer.rb</a></p>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p03">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080126#p03</link>
<dc:date>2008-07-14T09:55:10+09:00</dc:date>
<title>[PKI] XPIの署名</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>PKI</dc:subject>
<description>Firefoxのプラグインの.xpiファイルの署名もJARと同じ形式になっている。が、NSSに入っているsigntoolが作るシグネチャファイルは少し様子が違っている。 例えばGoogle Toolbarのシグネチャファイルはこうなっていて、 % cat zigbert.sf Signature-Version: 1.0 Created-By: Signtool (signtool 3.10) Comments: PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT. Digest-Algorithms: MD5 SHA1 MD5-Digest: CwgVkaOEmNlOXuKhcYA8cw== SHA1-Digest: 64fV2j8x051y7bXLEe5eT8UqOoY= Name: install.rdf Digest-Algorithms: MD5 SHA1 MD5-Digest:..</description>
<content:encoded><![CDATA[<h3>[PKI] XPIの署名</h3>Firefoxのプラグインの.xpiファイルの署名もJARと同じ形式になっている。が、NSSに入っているsigntoolが作るシグネチャファイルは少し様子が違っている。
例えばGoogle Toolbarのシグネチャファイルはこうなっていて、
<pre>
% cat zigbert.sf
Signature-Version: 1.0
Created-By: Signtool (signtool 3.10)
Comments: PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT.
Digest-Algorithms: MD5 SHA1
MD5-Digest: CwgVkaOEmNlOXuKhcYA8cw==
SHA1-Digest: 64fV2j8x051y7bXLEe5eT8UqOoY=
  
Name: install.rdf
Digest-Algorithms: MD5 SHA1
MD5-Digest: ST03pbw8FVpPRKmrmK/awg==
SHA1-Digest: rcQpl1IeiNNmMhYSHBPME3gCiSE=
...
</pre>
SHA1-Digest-Manifestがない代わりにマニフェストファイルの先頭部分のダイジェストがSHA1-Digestとして格納されている。
また、jarsignerは各エントリの最後の行の次の空行まで(次のエントリの手前の空行までかも)も含めてダイジェストに含めるのに対して、signtoolは空行は含めないようだ。
<pre>
Name: install.rdf
Digest-Algorithms: MD5 SHA1
MD5-Digest: 4LQ6yp0Lw2GOFqZbJAIIBA==
SHA1-Digest: TmVW6JP52g7IoqLPcZBgXGv1Yek=
              ← ここの空行はsigntoolの作るダイジェストには入ってない
</pre>
確認してみる。
<pre>
% ruby -r digest/sha1 -e 'p [Digest::SHA1.digest("Name: install.rdf\nDigest-Algorithms: MD5 SHA1\nMD5-Digest: 4LQ6yp0Lw2GOFqZbJAIIBA==\nSHA1-Digest: TmVW6JP52g7IoqLPcZBgXGv1Yek=\n")].pack("m")'
"rcQpl1IeiNNmMhYSHBPME3gCiSE=\n"
</pre>
ということは互換性がないのでは？と思ったが、jarsignerで.xpiを検証するとちゃんと検証できてるので、そのへんはよろしくやってくれるらしい。
証明書の有効期限が切れているのはご愛嬌 :-)
<pre>
% jarsigner --verify --verbose google-toolbar-linux.xpi
  
        3247 Mon May 28 01:28:16 JST 2007 META-INF/zigbert.rsa
sm      7789 Fri May 25 10:12:46 JST 2007 LICENSE.txt
	2307 Mon May 28 01:28:16 JST 2007 META-INF/manifest.mf
	2415 Mon May 28 01:28:16 JST 2007 META-INF/zigbert.sf
sm    574267 Fri May 25 10:12:46 JST 2007 chrome/google-toolbar.jar
sm      2599 Fri May 25 10:12:46 JST 2007 chrome.manifest
...
jar verified.
  
Warning: 
This jar contains entries whose signer certificate has expired. 
  
Re-run with the -verbose and -certs options for more details.
</pre>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p02">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080126#p02</link>
<dc:date>2008-07-14T09:55:10+09:00</dc:date>
<title>[PKI] JARの署名</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>PKI</dc:subject>
<description>ついでなので署名付きJARファイルのMETA-INF以下を調べることにする。 JavaWebStartから起動する日レセのJavaクライアントパッケージには書名してあったはずなので展開してみる。 % unzip pandaclient.jar META-INF/\* Archive: pandaclient.jar inflating: META-INF/MANIFEST.MF inflating: META-INF/JAVACLIE.SF inflating: META-INF/JAVACLIE.RSA % ls META-INF JAVACLIE.RSA JAVACLIE.SF MANIFEST.MF META-INFの下にMANIFEST.MFの他に、JAVACLIE.SFとJAVACLIE.RSAというファイルがあるのが分かる。 % cat MANIFEST.MF Manifest-Version:..</description>
<content:encoded><![CDATA[<h3>[PKI] JARの署名</h3>ついでなので署名付きJARファイルのMETA-INF以下を調べることにする。
JavaWebStartから起動する日レセのJavaクライアントパッケージには書名してあったはずなので展開してみる。
<pre>
% unzip pandaclient.jar META-INF/\*
Archive:  pandaclient.jar
  inflating: META-INF/MANIFEST.MF    
  inflating: META-INF/JAVACLIE.SF    
  inflating: META-INF/JAVACLIE.RSA   
% ls META-INF
JAVACLIE.RSA  JAVACLIE.SF  MANIFEST.MF
</pre>
META-INFの下にMANIFEST.MFの他に、JAVACLIE.SFとJAVACLIE.RSAというファイルがあるのが分かる。
<pre>
% cat MANIFEST.MF
Manifest-Version: 1.0
Class-Path: log4j.jar WebKit.jar
Created-By: 1.4.2-p6-root_30_nov_2004_12_44 (Sun Microsystems Inc.)
Ant-Version: Apache Ant 1.6.2
Main-Class: org.montsuqi.client.Launcher
  
Name: org/montsuqi/widgets/TimerListener.class
SHA1-Digest: /G2UR/R6qb4iVvPVVLlR3x7cjMA=
...
</pre>
というマニフェストファイルに対して、
<pre>
% cat JAVACLIE.SF
Signature-Version: 1.0
Created-By: 1.4.2-p6 (Sun Microsystems Inc.)
SHA1-Digest-Manifest: d9o/5rbyQ+daYAYpCehaneC5cWA=
  
Name: org/montsuqi/widgets/TimerListener.class
SHA1-Digest: x45aNFi91KYvt+ChYfrGPvQHGGc=
...
</pre>
このようなシグネチャファイル(JAVACLIE.SF)が作られて、このシグネチャファイルをPKCS #7のdetached形式で書名したものがJAVACLIE.RSAに格納されているらしい。
Sunの「<a href="http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#Signed%20JAR%20File">JAR File Specification</a>」の説明とは項目の名前が少し違っているが、シグネチャファイルの先頭のほうにあるSHA1-Digest-ManifestがMANIFEST.MF全体のダイジェストで、それに続く各エントリはMANIFESTのNameで始まる各エントリのダイジェストになっている。
<pre>
% ruby -r digest/sha1 -e 'p [Digest::SHA1.digest("Name: org/montsuqi/widgets/TimerListener.class\r\nSHA1-Digest: /G2UR/R6qb4iVvPVVLlR3x7cjMA=\r\n\r\n")].pack("m")'
"x45aNFi91KYvt+ChYfrGPvQHGGc=\n"
</pre>]]></content:encoded>
</item>
<item rdf:about="http://diary.does.notwork.org/gotoyuzo/?date=20080126#p01">
<link>http://diary.does.notwork.org/gotoyuzo/?date=20080126#p01</link>
<dc:date>2008-07-14T09:55:10+09:00</dc:date>
<title>[PKI][Ruby] RubyGemsの署名</title>
<dc:creator>GOTOU Yuuzou</dc:creator>
<dc:subject>PKI</dc:subject>
<dc:subject>Ruby</dc:subject>
<description>RubyGemsの署名がどうなっているか気になったのでlib/rubygems読んでみる。 署名自体は.gemに入っているmetadata.gzとdata.tar.gzのダイジェストを作ってOpenSSL::PKey::RSA#signで署名して、それぞれmetadata.gz.sigとdata.tar.gz.sigという名前でtarballに追加するらしい。インストールした後で検証できないけど、拡張ライブラリをビルドする場合はバイナリ配布じゃない場合もあるしねえ。独自の証明書チェーンの実装はよくわからなかったのでパス(ごめんなさい)。</description>
<content:encoded><![CDATA[<h3>[PKI][Ruby] RubyGemsの署名</h3><p>RubyGemsの署名がどうなっているか気になったのでlib/rubygems読んでみる。
</p><p>署名自体は.gemに入っているmetadata.gzとdata.tar.gzのダイジェストを作ってOpenSSL::PKey::RSA#signで署名して、それぞれmetadata.gz.sigとdata.tar.gz.sigという名前でtarballに追加するらしい。インストールした後で検証できないけど、拡張ライブラリをビルドする場合はバイナリ配布じゃない場合もあるしねえ。独自の証明書チェーンの実装はよくわからなかったのでパス(ごめんなさい)。</p>]]></content:encoded>
</item>
</rdf:RDF>
