Page 1 of 1

Compile pyGlobalplatform on Windows OS

Posted: Tue Jan 12, 2016 11:45 pm
by JavaCardOS
1. Install cmake.

2. Download GlobalPlatform open source project Library file from this page, which has been compiled.

3. Go to pyGlobalPlatform source code directory where CMakeLists.txt exists.

4. Execute command cmake to generate Visual Studio project file.

5. Use Visual Studio to open the project file.

6. Add include directory:
X:\Python27\include (where Python.h exists)
PATH_TO_GLOBALPLATFORM_PATH (where globalplatform.h exists)

7. Add lib directory:
X:\Python27\libs (where Python27.lib exists)
PATH_TO_GLOBALPLATFORM_PATH ( where globalplatform.lib exists)

8. Build.

9. Generate pyglobalplatform.dll, rename the file to pyglobalplatform.pyd, copy and paste it to X:\Python27\Dlls .

10.Usage:

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'
    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.To run needs the following four dynamic libraries - globalplatform.dll / GPPcScConnectionPlugin.dll / libeay32.dll / ssleay32.dll
Please make sure that they are under system PATH directory.
2. If you have any problem, feel free to address them here!