ひさびさの授業

nogajun
nogajun

_

疲れましたですよ。

_ DebianでICカードリーダSCR3310を使って住基カードが認識するか見てみる

去年、使うかなーと思って買った SCR3310 というICカードリーダがあります。

https://www.amazon.co.jp/dp/B0085H4YZC

買ったあと住基カードも作っていたのですが、なんだかんだでそのまま放置していたので、DebianでICカードリーダが認識して住基カードが読めるか確認してみました。 まず、lsusbでみるとこんな感じ。

# lsusb
Bus 005 Device 015: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1 / SCR3310 SmartCard Reader

これを手がかりに調べてみるとDebian Wikiに「Smartcards - Debian Wiki」というページがあり、pcscdとlibccidで認識できるそうなのでpcscdとpcsc-toolsをインストールしてみた。

# apt-get install pcscd pcsc-tools

これで、ICカードリーダーに住基カードを差してみたら緑のランプが光った! 続いて pcsc_scan コマンドを実行してみた。

# pcsc_scan
PC/SC device scanner
V 1.4.21 (c) 2001-2011, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.8.7
Using reader plug'n play mechanism
Scanning present readers...
0: SCM Microsystems Inc. SCR 3310 [CCID Interface] 00 00

Fri Sep 27 20:50:50 2013
Reader 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] 00 00
  Card state: Card inserted,
  ATR: 3B E0 00 FF 81 31 FE 45 14

ATR: 3B E0 00 FF 81 31 FE 45 14
+ TS = 3B --> Direct Convention
+ T0 = E0, Y(1): 1110, K: 0 (historical bytes)
  TB(1) = 00 --> VPP is not electrically connected
  TC(1) = FF --> Extra guard time: 255 (special value)
  TD(1) = 81 --> Y(i+1) = 1000, Protocol T = 1
-----
  TD(2) = 31 --> Y(i+1) = 0011, Protocol T = 1
-----
  TA(3) = FE --> IFSC: 254
  TB(3) = 45 --> Block Waiting Integer: 4 - Character Waiting Integer: 5
+ Historical bytes:
+ TCK = 14 (correct checksum)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B E0 00 FF 81 31 FE 45 14
        "JUKICARD", digitally sign tax documents in Japan

とりあえず認識したようです。

これで JSignPdf を使ってPDFに署名できるか調べてみよう。