• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# What?
2
3ese-relay connects libese's functionality to a local abstract socket on
4an Android device.  The primary purpose is to ease development and provision
5with test hardware without bringing up all the development tools needed.
6
7ese-relay uses the same wire protocol as the
8[Virtual Smart Card](http://frankmorgner.github.io/vsmartcard/) project by acting
9as the "viccd" service.  This enables use of any tool that supports
10[pcsc-lite](https://pcsclite.alioth.debian.org/) without any additional
11development.
12
13# Wire protocol
14
15The format is always
16    Ln d0..dn
17Ln is a network byte order 16-bit unsigned integer length of the data.
18d0..dn are uint8_t bytes to tunneled directly to/from the card.
19
20If Ln == 1, it indicates an out of band control message. Supported messages
21are 1:0 - 1:4:
22  * 0: Power off (ignored)
23  * 1: Power on (implemented with a reset)
24  * 3: Reset
25  * 4: ATR - returns a fake ATR
26
27# Prerequisites
28
29  * pcscd is installed on your system.
30  * Build and install https://frankmorgner.github.io/vsmartcard/virtualsmartcard
31  * Configure /etc/reader.d/vpcd as below.
32  * Build ese-relay configured for the hardware in use.
33
34## /etc/reader.conf.d/vpcd:
35
36    FRIENDLYNAME "Virtual PCD"
37    DEVICENAME   localhost:0x1000
38    LIBPATH      /usr/lib/pcsc/drivers/serial/libifdvpcd.so
39    CHANNELID    0x1000
40
41This will cause pcscd to connect to localhost port 4096 on start as per the vsmartcard
42documentation.
43
44# Usage
45## In one terminal, run the service and forward the abstract UNIX socket to a local TCP socket:
46  $ adb shell ese-relay-<hw>
47  $ adb forward tcp:4096 localabstract:ese-relay
48
49## In another terminal, restart pcscd configured with an appropriate reader:
50  $ /etc/init.d/pcscd restart # (Or whatever your init system requires.)
51
52## In yet another terminal, use your preferred* pcsc client:
53
54  $ java -jar gp.jar -info
55
56* https://github.com/martinpaljak/GlobalPlatformPro is used here.
57