SCAutolib.models.card
This module implements classes for communication with different types of cards that we are using in the library. Those types are: virtual smart card, real (physical) smart card in standard reader, cards in the removinator.
Classes
- class Card[source]
Interface for child classes. All child classes will rewrite common methods based on the type of the card.
- class PhysicalCard(card_data=None, card_dir=None)[source]
- :TODO PhysicalCard is not yet tested, it’s Work In Progress
This class provides methods allowing to manipulate physical cards connected via removinator.
- TODO this is not yet tested, insert and remove methods need to be
implemented with removinator
Initialise object for physical smart card. Constructor of the base class is also used.
- class VirtualCard(card_data, softhsm2_conf=None, card_dir=None, key=None, cert=None)[source]
This class provides methods for operations on virtual smart card. Virtual smart card by itself is represented by the systemd service in the system. The card relates to some user, so providing the user is essential for correct functioning of methods for the virtual smart card.
Card root directory has to be created before calling any method
Initialise virtual smart card. Constructor of the base class is also used.
- Parameters:
card_data (dict) – dict containing card details as pin, cardholder etc.
softhsm2_conf (pathlib.Path) – path to SoftHSM2 configuration file
card_dir (pathlib.Path) – path to card directory where card files will be saved
key (pathlib.Path) – path to key - if the key exist it will be used with the card
cert (pathlib.Path) – path to certificate. If file exist it will be used with the card
- create()[source]
Creates SoftHSM2 token and systemd service for virtual smart card. Directory for NSS database is created in this method as separate DB is required for each virtual card.
- delete()[source]
Deletes the virtual card directory which contains certs, SoftHSM2 token and NSS database. Also removes the systemd service for virtual smart card.
- enroll()[source]
Upload certificate and private key to the virtual smart card (upload to NSS database) with pkcs11-tool.