Code: Select all
# Import the module
import globalplatformlib as gp
# Establish Context
context = gp.establishContext()
# Select the smartcard reader you want to connect
readernames = gp.listReaders(context)
readerName=readernames[0]
#Connect reader
cardInfo = gp.connectCard(context, readerName, gp.SCARD_PROTOCOL_Tx)
# Get SCP details
scp, scpi = gp.getSCPDetails(context, cardInfo)
# Mutual Authentication
securityInfo = gp.mutualAuthentication(context, cardInfo, gp.DEFAULT_KEY, gp.DEFAULT_KEY, gp.DEFAULT_KEY, gp.DEFAULT_KEY, 0, 0, scp, scpi, 0, 0)
# Release context
gp.releaseContext(context)