utils Module¶

-
class
virtualsmartcard.utils.APDU(*args, **kwargs)¶ Bases:
objectBase class for an APDU
-
_deldata()¶
-
_format_parts(fields)¶ utility function to be used in __str__ and __repr__
-
_getdata()¶
-
_setbyte(name, value)¶
-
_setdata(value)¶
-
property
data¶ The data contents of this APDU
-
-
class
virtualsmartcard.utils.C_APDU(*args, **kwargs)¶ Bases:
virtualsmartcard.utils.APDUClass for a command APDU
-
property
CLA¶ The CLA attribute of the APDU
-
property
INS¶ The INS attribute of the APDU
-
property
Lc¶ The Lc attribute of the APDU
-
property
Le¶ The Le attribute of the APDU
-
property
P1¶ The P1 attribute of the APDU
-
property
P2¶ The P2 attribute of the APDU
-
_deldata()¶
-
_format_fields()¶
-
_format_parts(fields)¶ utility function to be used in __str__ and __repr__
-
_getdata()¶
-
_setbyte(name, value)¶
-
_setdata(value)¶
-
case()¶ Return 1, 2, 3 or 4, depending on which ISO case we represent.
-
property
cla¶ The CLA attribute of the APDU
-
property
data¶ The data contents of this APDU
-
property
effective_Le¶
-
property
ins¶ The INS attribute of the APDU
-
property
lc¶ The Lc attribute of the APDU
-
property
le¶ The Le attribute of the APDU
-
property
p1¶ The P1 attribute of the APDU
-
property
p2¶ The P2 attribute of the APDU
-
parse(apdu)¶ Parse a full command APDU and assign the values to our object, overwriting whatever there was.
-
render()¶ Return this APDU as a binary string
-
property
-
class
virtualsmartcard.utils.R_APDU(*args, **kwargs)¶ Bases:
virtualsmartcard.utils.APDUClass for a response APDU
-
property
SW¶ The Status Word of this response APDU
-
property
SW1¶ The SW1 attribute of the APDU
-
property
SW2¶ The SW2 attribute of the APDU
-
_deldata()¶
-
_format_fields()¶
-
_format_parts(fields)¶ utility function to be used in __str__ and __repr__
-
_getdata()¶
-
_getsw()¶
-
_setbyte(name, value)¶
-
_setdata(value)¶
-
_setsw(value)¶
-
property
data¶ The data contents of this APDU
-
parse(apdu)¶ Parse a full response APDU and assign the values to our object, overwriting whatever there was.
-
render()¶ Return this APDU as a binary string
-
property
sw¶ The Status Word of this response APDU
-
property
sw1¶ The SW1 attribute of the APDU
-
property
sw2¶ The SW2 attribute of the APDU
-
property
-
virtualsmartcard.utils._make_byte_property(prop)¶ Make a byte property(). This is meta code.
-
virtualsmartcard.utils.hexdump(data, indent=0, short=False, linelen=16, offset=0)¶ Generates a nice hexdump of data and returns it. Consecutive lines will be indented with indent spaces. When short is true, will instead generate hexdump without adresses and on one line.
Examples: hexdump(b’A’) -> ‘0000: 00 41 .A ‘ hexdump(b’A’, short=True) -> ‘00 41 (.A)’
-
virtualsmartcard.utils.inttostring(i, length=None, len_extendable=False)¶
-
virtualsmartcard.utils.stringtoint(data)¶