In order to thank you for all members' support of our website, we are holding new events - Getting Free Samples by Paying Freight only.
Want to get free samples? Please check this post for more details.

Compile pyGlobalplatform on Linux OS

pyGlobalPlatform is a open source python library of globalplatform client library.
User avatar
JavaCardOS
Posts: 263
Joined: Thu Apr 30, 2015 12:00 pm
Points :2295
Contact:

Compile pyGlobalplatform on Linux OS

Post by JavaCardOS » Wed Jan 13, 2016 2:14 am

Take Ubuntu for example.

1. Install cmake

Code: Select all

sudo apt-get install cmake


2. Install make

Code: Select all

sudo apt-get install automake


3.Install gcc

Code: Select all

sudo apt-get install gcc


4.Install g++

Code: Select all

sudo apt-get install g++


5. Enter pyGlobalPlatform source code directory. Execute cmake to generate Makefile
Note: Whether to execute step 2 to 3 is according to your own system situation.
You can of course execute the command of this step to install the corresponding tools your system lacks according to the system prompt.

6. Execute make command

Code: Select all

make
make install (Administrator permission required)


7. Enter python

Code: Select all

import pyglobalplatform as gp

c = gp.establishContext()
readername = gp.listReaders(c)[0]
ci = gp.connectCard(c, readername, 1)
selectCommand = '\x00\xA4\x04\x00\x00'
for i in xrange(1000):
      print ">> " + "".join("%02X" %(ord(v)) for v in selectCommand)
      print "<< " + "".join("%02X" %(ord(v)) for v in gp.GP211_send_APDU(c, ci, None, selectCommand))
gp.disconnectCard(c, ci)
gp.releaseContext(c)


Note:
1. Please be sure that you have already installed GlobalPlatform and gppcscconnectionplugin
2. If GlobalPlatform and gppcscconnectionplugin are installed under /usr/local/lib, you need to add LD_LIBRARY_PATH:

Code: Select all

 export LD_LIBRARY_PATH="/usr/lib;/usr/local/lib;"

3. If you have any problem, feel free to address them here!

Who is online

Users browsing this forum: No registered users and 1 guest

JavaCard OS : Disclaimer