Jun 30, 2008
[Apple] GnuPG on Mac OS X メモ
Mac OS X に GnuGP を入れてみた。 MacPorts を使ってインストール出来るので至極簡単。
GnuPG のインストール
$ sudo port search gnupg qca-gnupg devel/qca-gnupg 2.0.0-beta2 Qt Cryptographic Architecture - openssl plugin gnupg mail/gnupg 1.4.7 GNU pretty-good-privacy package gnupg12 mail/gnupg12 1.2.7 GNU Privacy Guard gnupg2 mail/gnupg2 2.0.8 GNU pretty-good-privacy package p5-gnupg-interface perl/p5-gnupg-interface 0.33 Perl interface to GnuPG py-gnupg python/py-gnupg 0.3.2 GnuPGInterface is a Python module to interface with GnuPG py25-gnupg python/py25-gnupg 0.3.2 GnuPGInterface is a Python module to interface with GnuPG $ $ sudo port install gnupg ---> Fetching ncursesw ---> Attempting to fetch ncurses-5.6.tar.gz from http://ftp.gnu.org/gnu/ncurses ---> Verifying checksum(s) for ncursesw ---> Extracting ncursesw ---> Applying patches to ncursesw ---> Configuring ncursesw (SNIP) ---> Staging gnupg into destroot ---> Installing gnupg 1.4.7_0 ---> Activating gnupg 1.4.7_0 ---> Cleaning gnupg $
GnuPG の動作確認
$ gpg --version gpg (GnuPG) 1.4.7 Copyright (C) 2006 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. $
GnuPG を使って復号化
$ gpg -d ./dummy.gpg > ./dummy gpg: CAST5 encrypted data gpg: encrypted with 1 passphrase gpg: WARNING: message was not integrity protected $
Jun 23, 2008
[Apple] Cyberduck メモ
Cyberduck は Mac OS X で動作する FTP, SFTP クライアント。SSH の公開鍵認証に対応している。 今までは Fugu を使用していたのだけれど、 残念なことに Fugu は公開鍵認証ができない。 公開鍵認証が必要になったので、今回 Fugu から Cyberduck に乗り換えてみた。
Cyberduck is an open source FTP, SFTP, WebDAV and Amazon S3 browser licenced under the GPL with an easy to use interface, integration with external editors and support for many Mac OS X system technologies such as Spotlight, Bonjour, QuickLook and the Keychain.
- Cyberduck
- http://cyberduck.ch/
Jun 19, 2008
[Library] QR コードクラスライブラリ for Java にチャレンジ
QR コードクラスライブラリ for Java とは
QR コードクラスライブラリ for Java は、文字列から QR コードのデータを作成する Java 用のライブラリ。 ライブラリに文字列を渡すと boolean[][] の配列を返してくれる。 良く見かける QR コードの画像は boolean[][] から自前で作成する。
- QR コードクラスライブラリ for Java
- http://www.swetake.com/qr/java/qr_java.html
QR コードクラスライブラリ for Java で QR コード画像を作成してみる。
とりあえず ↓ の情報だけは一通り目を通すと良い。
- QR コードクラスライブラリ for Java - API Document
- http://www.swetake.com/qr/java/docs/index.html
- QR Code.com - バージョンの決定
- http://www.denso-wave.com/qrcode/vertable1.html
- QR Code.com - コード領域の確定
- http://www.denso-wave.com/qrcode/qrgene4.html
作成した画像をテストするには ↓ のツールを使用すると便利。
- Psytec - QR Code Editor
- http://www.psytec.co.jp/docomo.html
サンプルコード
// QRコードクラスライブラリ for Java の準備。
Qrcode qrcodeLogic = new Qrcode();
qrcodeLogic.setQrcodeEncodeMode('*');
qrcodeLogic.setQrcodeErrorCorrect('M');
qrcodeLogic.setQrcodeVersion(7);
// QR コードデータを作成。
byte[] targetBytes = target.getBytes();
boolean[][] qrcodeData = qrcodeLogic.calQrcode(targetBytes);
// QR コード画像用の BufferedImage を準備。
// 周りに 4cell 分のマージンを用意する。
BufferedImage image = new BufferedImage(size.getCellSize()
* (qrcodeData[0].length + 8), size.getCellSize()
* (qrcodeData[0].length + 8), BufferedImage.TYPE_INT_BGR);
Graphics g = image.getGraphics();
g.setColor(QRCODE_IMAGE_BACKGROUNDCOLOR);
g.fillRect(0, 0, image.getWidth(), image.getHeight());
// QR コードデータを画像に変換。
for (int i = 0; i < qrcodeData.length; i++) {
for (int j = 0; j < qrcodeData[i].length; j++) {
boolean cellFilled = qrcodeData[i][j];
Color cellColor = cellFilled ? QRCODE_IMAGE_FOREGROUNDCOLOR
: QRCODE_IMAGE_BACKGROUNDCOLOR;
g.setColor(cellColor);
g.fillRect(size.getCellSize() * (i + 4), size.getCellSize()
* (j + 4), size.getCellSize(), size.getCellSize());
}
}
g.dispose();

![[Cyberduck]](/blog/entries/Apple/20080623_01/cyberduck.png)


