大阪日本橋のPCショップ イオシスで、ジャンク品扱いのICカードリーダライタ ACR1251DI-NTTComが1,680円(税込)で売っていたので購入した。
これが、ICカード リーダライタは3機種目となる。
それぞれ、購入時の価格は
FeliCa | Type A/B | マイナンバー | |||
---|---|---|---|---|---|
ACR1251DI | 1,680円 | 2022/12/04購入(大阪日本橋IOSYS) | ○ | ○ | ○ |
SCM3310 | 19.99USD (1,628円) | 2012/05/30購入(eBay NETZTEIL) | × | × | ○ |
RC-S320 | 3,100円 | 2005/07/??購入 | ○ | × | × |
マイナンバーカード読み取りテスト
Windows 11のPCに接続して、マイナポータルWebページと、公的個人認証サービス利用者クライアントソフトが使えるか確認。
ACR1251DI | OK |
SCM3310 | OK |
公的個人認証サービス利用者クライアント ACR1251DI 接触
公的個人認証サービス利用者クライアント ACR1251DI 非接触
Linuxでの認識状況
Bus 001 Device 004: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1 / SCR3310 SmartCard Reader Bus 001 Device 014: ID 072f:221b Advanced Card Systems, Ltd ACR1251U-C Bus 001 Device 006: ID 054c:01bb Sony Corp. FeliCa S320 [PaSoRi]
Ubuntu Linuxのpcsc_scanで認識するかのテスト
ACR1251DI | OK |
SCM3310 | OK |
RC-S320 | NG(ドライバ無し) |
予め、pcscd, pcsc-tools をインストールしておく。
$ sudo apt install pcscd $ sudo apt install pcsc-tools
SCM3310でスマートカード(適当な例としてマイナンバーカードとクレジットカード)のスキャンを行う
マイナンバーカードを読み取った例
$ pcsc_scan Using reader plug'n play mechanism Scanning present readers... 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] (21120818205972) 00 00 Sun Dec 4 22:33:58 2022 Reader 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] (21120818205972) 00 00 Event number: 1 Card state: Card inserted, ATR: 3B DA 13 FF 81 31 FB 46 80 12 39 2F 31 C1 73 C6 01 C0 3B ATR: 3B DA 13 FF 81 31 FB 46 80 12 39 2F 31 C1 73 C6 01 C0 3B + TS = 3B --> Direct Convention + T0 = DA, Y(1): 1101, K: 10 (historical bytes) TA(1) = 13 --> Fi=372, Di=4, 93 cycles/ETU 43010 bits/s at 4 MHz, fMax for Fi = 5 MHz => 53763 bits/s 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) = FB --> IFSC: 251 TB(3) = 46 --> Block Waiting Integer: 4 - Character Waiting Integer: 6 + Historical bytes: 80 12 39 2F 31 C1 73 C6 01 C0 Category indicator byte: 80 (compact TLV data object) Tag: 1, len: 2 (country code, ISO 3166-1) Country code: 39 2F Tag: 3, len: 1 (card service data byte) Card service data byte: C1 - Application selection: by full DF name - Application selection: by partial DF name - EF.DIR and EF.ATR access services: by GET RECORD(s) command - Card without MF Tag: 7, len: 3 (card capabilities) Selection methods: C6 - DF selection by full DF name - DF selection by partial DF name - Short EF identifier supported - Record number supported Data coding byte: 01 - Behaviour of write functions: one-time write - Value 'FF' for the first byte of BER-TLV tag fields: invalid - Data unit in quartets: 2 Command chaining, length fields and logical channels: C0 - Command chaining - Extended Lc and Le fields - Logical channel number assignment: No logical channel - Maximum number of logical channels: 1 + TCK = 3B (correct checksum) Possibly identified card (using /usr/share/pcsc/smartcard_list.txt): 3B DA 13 FF 81 31 FB 46 80 12 39 2F 31 C1 73 C6 01 C0 3B My Number Card (The Social Security and Tax Number System in JAPAN) (eID) http://www.cas.go.jp/jp/seisaku/bangoseido/english.html
クレジットカード機能付きキャッシュカードを読み取った例
$ pcsc_scan Using reader plug'n play mechanism Scanning present readers... 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] (21120818205972) 00 00 Wed Dec 7 08:37:46 2022 Reader 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] (21120818205972) 00 00 Event number: 1 Card state: Card inserted, ATR: 3B EE 00 00 81 31 80 42 80 31 80 66 B1 A3 01 01 21 0A 83 00 90 00 E1 ATR: 3B EE 00 00 81 31 80 42 80 31 80 66 B1 A3 01 01 21 0A 83 00 90 00 E1 + TS = 3B --> Direct Convention + T0 = EE, Y(1): 1110, K: 14 (historical bytes) TB(1) = 00 --> VPP is not electrically connected TC(1) = 00 --> Extra guard time: 0 TD(1) = 81 --> Y(i+1) = 1000, Protocol T = 1 ----- TD(2) = 31 --> Y(i+1) = 0011, Protocol T = 1 ----- TA(3) = 80 --> IFSC: 128 TB(3) = 42 --> Block Waiting Integer: 4 - Character Waiting Integer: 2 + Historical bytes: 80 31 80 66 B1 A3 01 01 21 0A 83 00 90 00 Category indicator byte: 80 (compact TLV data object) Tag: 3, len: 1 (card service data byte) Card service data byte: 80 - Application selection: by full DF name - EF.DIR and EF.ATR access services: by GET RECORD(s) command - Card with MF Tag: 6, len: 6 (pre-issuing data) Data: B1 A3 01 01 21 0A Tag: 8, len: 3 (status indicator) LCS (life card cycle): 00 (No information given) SW: 9000 (Normal processing.) + TCK = E1 (correct checksum) Possibly identified card (using /home/vm/.cache/smartcard_list.txt): NONE Your card is not present in the database. Please submit your unknown card at: https://smartcard-atr.apdu.fr/parse?ATR=3BEE00008131804280318066B1A30101210A83009000E1
ACR1251DIはlibacsccidパッケージ(GitHub acshk/acsccid)をインストールしてから
$ sudo apt install libacsccid1
ACR1251DIでスマートカード(適当な例としてFeliCaチップのSuicaと、MIFAREチップのオランダのOV-Chipkaart)のスキャンを行う
Suica(FeliCaカード)を読み取った例
$ pcsc_scan Using reader plug'n play mechanism Scanning present readers... 0: ACS ACR1251U-C Smart Card Reader [ACR1251U-C Smart Card Reader] 00 00 Wed Dec 7 08:47:22 2022 Reader 0: ACS ACR1251U-C Smart Card Reader [ACR1251U-C Smart Card Reader] 00 00 Event number: 0 Card state: Card inserted, ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 11 00 3B 00 00 00 00 42 ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 11 00 3B 00 00 00 00 42 + TS = 3B --> Direct Convention + T0 = 8F, Y(1): 1000, K: 15 (historical bytes) TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0 ----- TD(2) = 01 --> Y(i+1) = 0000, Protocol T = 1 ----- + Historical bytes: 80 4F 0C A0 00 00 03 06 11 00 3B 00 00 00 00 Category indicator byte: 80 (compact TLV data object) Tag: 4, len: F (initial access data) Initial access data: 0C A0 00 00 03 06 11 00 3B 00 00 00 00 + TCK = 42 (correct checksum) Possibly identified card (using /home/vm/.cache/smartcard_list.txt): 3B 8F 80 01 80 4F 0C A0 00 00 03 06 11 00 3B 00 00 00 00 42 3B 8F 80 01 80 4F 0C A0 00 00 03 06 .. 00 3B 00 00 00 00 .. FeliCa (as per PCSC std part3) 3B 8F 80 01 80 4F 0C A0 00 00 03 06 11 00 3B 00 00 00 00 42 RFID - FeliCa (generic) (as per PCSC std part3) Suica public transit card (Japan IC system) (also: Hayakaken, ICOCA, Kitaca, manaca, nimoca, PASMO, PiTaPa, SUGOCA, TOICA) https://en.wikipedia.org/wiki/Suica Octopus, MTR network from Hong Kong, 2014
オランダのOV-Chipkaart(MIFARE)を読み取った例
$ pcsc_scan Using reader plug'n play mechanism Scanning present readers... 0: ACS ACR1251U-C Smart Card Reader [ACR1251U-C Smart Card Reader] 00 00 Mon Dec 5 22:44:19 2022 Reader 0: ACS ACR1251U-C Smart Card Reader [ACR1251U-C Smart Card Reader] 00 00 Event number: 0 Card state: Card inserted, ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69 ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69 + TS = 3B --> Direct Convention + T0 = 8F, Y(1): 1000, K: 15 (historical bytes) TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0 ----- TD(2) = 01 --> Y(i+1) = 0000, Protocol T = 1 ----- + Historical bytes: 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 Category indicator byte: 80 (compact TLV data object) Tag: 4, len: F (initial access data) Initial access data: 0C A0 00 00 03 06 03 00 02 00 00 00 00 + TCK = 69 (correct checksum) Possibly identified card (using /usr/share/pcsc/smartcard_list.txt): 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69 3B 8F 80 01 80 4F 0C A0 00 00 03 06 .. 00 02 00 00 00 00 .. MIFARE Classic 4K (as per PCSC std part3) 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 .. .. 00 00 00 00 .. RFID - ISO 14443 Type A Part 3 (as per PCSC std part3) 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69 RFID - ISO 14443 Type A - NXP Mifare card with 4k EEPROM
RC-S320でFeliCaの読み取り
libpafeライブラリ(https://github.com/rfujita/libpafe)を使うと簡単に読み取れる
まずはライブラリをインストールする
$ git clone https://github.com/rfujita/libpafe.git $ cd libpafe $ ./configure $ make $ sudo make install
Suicaカードを読み取り対象として、サンプルプログラムを走らせてみる
$ cd tests $ ./pasori_test PaSoRi (RC-S320) firmware version 1.40 Echo test... success EPROM test... success RAM test... success CPU test... success Polling test... success $ ./felica_dump # lpdump : Sun Dec 4 23:01:25 2022 # --- IDm info (FeliCa) --- # Manufacture Date = 2004/12/20 # SN = 9209 # Manufacture Code = 0101 # Equip. Code = 0105 system num 1 # FELICA SYSTEM_CODE = 0003 # card IDm = 010105011707F923 # card PMm = 04014B024F4993FF # area num = 7 # service num = 33 # AREA #0 = 0000 (00000) # AREA #1 = 0001 (00000) # AREA #2 = 0020 (00000) # AREA #3 = 003F (00000) # AREA #4 = 0040 (00000) # AREA #5 = 005F (00000) # AREA #6 = 0060 (00000) # 0001:0008 Ramdom Access R/W (PROTECTED) # 0001:000a Random Access Read only (PROTECTED) # 0002:0008 Ramdom Access R/W (PROTECTED) # 0002:000b Random Access Read only 0002:0000:00000000000000002200000900000053 # 0020:0010 Purse (Direct) (PROTECTED) # 0020:0012 Purse (Cashback/decrement) (PROTECTED) # 0020:0016 Purse (Read Only) (PROTECTED) # 0021:0010 Purse (Direct) (PROTECTED) # 0021:0012 Purse (Cashback/decrement) (PROTECTED) # 0021:0016 Purse (Read Only) (PROTECTED) # 0022:0010 Purse (Direct) (PROTECTED) # 0022:0012 Purse (Cashback/decrement) (PROTECTED) # 0022:0016 Purse (Read Only) (PROTECTED) # 0023:0008 Ramdom Access R/W (PROTECTED) # 0023:000a Random Access Read only (PROTECTED) # 0024:000c Cyclic Access R/W (PROTECTED) # 0024:000f Cyclic Access Read only 0024:0000:16010002202E8224851F0900000053A0 0024:0001:03020000202E841F0000BD0000005280 0024:0002:C7460000202C8CAAD5D0B30000005000 0024:0003:C84600001F9C7E8189171F0100004F00 0024:0004:C74600001F997ACAD5D0410200004E00 0024:0005:160100021F98C5D0C506190300004DA0 0024:0006:080200001F95C5D00000EB0300004B80 0024:0007:038500020F6B5B035F16030000004A00 〜 中略 〜 0061:001D:00000000000000000000000000000000 0061:001E:00000000000000000000000000000000 0061:001F:00000000000000000000000000000000 0061:0020:00000000000000000000000000000000 0061:0021:00000000000000000000000000000000 0061:0022:00000000000000000000000000000000 0061:0023:00000000000000000000000000000000