desfire package

Submodules

desfire.android module

class desfire.android.AndroidDevice(iso_dep)[source]

Bases: desfire.device.Device

DESFire protocol wrapper for pyscard interface.

Iso_dep:android.nfc.tech.IsoDep Java class wrapped as jnius object.
transceive(bytes)[source]

Note

Android API may return byte array memory views that are easily corrupted by native APIs, so we just copy all incoming bytes to a proper list as soon as possible on Android.

desfire.device module

class desfire.device.Device[source]

Bases: object

Abstract base class which uses underlying device communication channel.

transceive(bytes)[source]

Send in APDU request and wait for the response.

Parameters:bytes – Outgoing bytes as list of bytes or byte array
Returns:List of bytes or byte array from the device.

desfire.dummy module

class desfire.dummy.DummyDevice[source]

Bases: desfire.device.Device

Dummy device mock implementation.

transceive(bytes)[source]

desfire.pcsc module

class desfire.pcsc.PCSCDevice(card_connection)[source]

Bases: desfire.device.Device

DESFire protocol wrapper for pyscard interface.

Card_connection:
 smartcard.pcsc.PCSCCardConnection.PCSCCardConnection instance. Call card_connection.connect() before calling any DESFire APIs.
transceive(bytes)[source]
exception desfire.pcsc.PCSCNotConnected[source]

Bases: exceptions.Exception

Tried to transmit to non-open connection.

desfire.protocol module

desfire.util module

Misc. utility functions.

desfire.util.byte_array_to_byte_string(bytes)[source]
desfire.util.byte_array_to_human_readable_hex(bytes)[source]
desfire.util.byte_string_to_byte_array(s)[source]
desfire.util.dword_to_byte_array(value)[source]
desfire.util.hex_array_to_byte_string(hex_array)[source]
desfire.util.word_to_byte_array(value)[source]

Module contents