cryptnoxpy.reader

Module that handles different card reader types and their drivers.

Module Contents

Classes

Reader

Abstract class describing methods to be implemented. Holds the connection.

NfcReader

Specialized reader using xantares/nfc-binding

SmartCard

Generic smart card reader class

Functions

get(index: int = 0) → Reader

Get the reader that can be found on the given position.

Attributes

NFC_AVAILABLE

SMARTCARD_AVAILABLE

NFC_AVAILABLE

SMARTCARD_AVAILABLE

cryptnoxpy.reader.NFC_AVAILABLE = True
cryptnoxpy.reader.SMARTCARD_AVAILABLE = True
cryptnoxpy.reader.NFC_AVAILABLE = False
cryptnoxpy.reader.SMARTCARD_AVAILABLE = False
exception cryptnoxpy.reader.ReaderException

Bases: Exception

Reader hasn’t been found or other reader related issues

exception cryptnoxpy.reader.CardException

Bases: Exception

The reader is present but there is an issue in connecting to the card

exception cryptnoxpy.reader.ConnectionException

Bases: Exception

An issue has occurred in the communication with the card.

class cryptnoxpy.reader.Reader

Abstract class describing methods to be implemented. Holds the connection.

__del__(self)
abstract connect(self) None

Connect to the card found in the selected reader.

Returns

None

abstract send(self, apdu: List[int]) Tuple[List[str], int, int]

Send APDU to the reader and card and retrieve the result with status codes.

Parameters

apdu (List[int]) – Command to be sent

Returns

Return the result of the query and two status codes

Return type

Tuple[List[str], int, int]

bool(self) bool

Is there an active connection

Return type

Is there an active connection

Returns

bool

classmethod __subclasshook__(cls, c)

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

class cryptnoxpy.reader.NfcReader

Bases: Reader

Specialized reader using xantares/nfc-binding

connect(self)

Connect to the card found in the selected reader.

Returns

None

send(self, apdu: List[int]) Tuple[List[str], int, int]

Send APDU to the reader and card and retrieve the result with status codes.

Parameters

apdu (List[int]) – Command to be sent

Returns

Return the result of the query and two status codes

Return type

Tuple[List[str], int, int]

class cryptnoxpy.reader.SmartCard(index: int = 0)

Bases: Reader

Generic smart card reader class

Parameters

index (int) – Index of the reader to initialize.

connect(self) None

Connect to the card found in the selected reader.

Returns

None

send(self, apdu: List[int]) Tuple[List[str], int, int]

Send APDU to the reader and card and retrieve the result with status codes.

Parameters

apdu (List[int]) – Command to be sent

Returns

Return the result of the query and two status codes

Return type

Tuple[List[str], int, int]

cryptnoxpy.reader.get(index: int = 0) Reader

Get the reader that can be found on the given position.

Parameters

index (int) – Index of reader to be initialized and used

Returns

Reader object that can be used.

Return type

Reader