Bases: virtualsmartcard.SmartcardSAM.SAM
SAM for ICAO ePassport. Implements Basic access control and key derivation for Secure Messaging.
Decrypt the given data, using the parameters stored in the SAM. Right now we do not encrypt the data. In memory encryption might or might not be added in a future version.
Encrypt the given data, using the parameters stored in the SAM. Right now we do not encrypt the data. In memory encryption might or might not be added in a future version.
Computes the keys depending on the machine readable zone of the passport according to TR-PKI mrtds ICC read-only access v1.1 annex E.1.
This method returns the key specified by the p2 parameter. The key may be stored on the cards filesystem.
Parameters: |
|
---|
Change the specified referenced data (e.g. CHV) of the card
Derive a key according to TR-PKI mrtds ICC read-only access v1.1 annex E.1. c is either 1 for encryption or 2 for MAC computation. Returns: Ka + Kb Note: Does not adjust parity. Nobody uses that anyway ...
Erases a Security Environment stored under SEID from the SAM
Performs the basic access control protocol as defined in the ICAO MRTD standard
Generate a random number of maximum 8 Byte and return it.
Authenticate card to terminal. Encrypt the challenge of the terminal to prove key posession
Takes an encrypted challenge in the form ‘Terminal Challenge | Card Challenge | Card number’ and checks it for validity. If the challenge is successful the card encrypts ‘Card Challenge | Terminal challenge’ and returns this value
Parse a command APDU protected by Secure Messaging and return the unprotected command APDU
Protect a plain response APDU by Secure Messaging
Restores a Security Environment from the SAM and replaces the current SE with it.
Setter function for the internal reference to the Filesystem. The SAM needs a reference to the filesystem in order to store/retrieve keys.
Parameters: |
|
---|
Stores the current Security environment in the secure access module. The SEID is used as a reference to identify the SE.
Authenticate the card user. Check if he entered a valid PIN. If the PIN is invalid decrement retry counter. If retry counter equals zero, block the card until reset with correct PUK
Bases: virtualsmartcard.SEutils.Security_Environment
This class implements the Security Environment of the ICAO Passports. It is required in order to use the send sequence counter for secure messaging.
Manipulate the current Security Environment. P2 is the tag of a control reference template, data contains control reference objects
Compute a cryptographic checksum (e.g. MAC) for the given data. The ePass uses a Send Sequence Counter for MAC calculation
Compute a digital signature for the given data. Algorithm and key are specified in the current SE
Parameters: |
|
---|
Decipher data using key, algorithm, IV and Padding specified by the current Security environment.
Returns: | raw data (no TLV coding). Padding is not removed!!! |
---|
Encipher data using key, algorithm, IV and Padding specified by the current Security environment.
Returns: | raw data (no TLV coding). |
---|
The GENERATE PUBLIC-KEY PAIR command either initiates the generation and storing of a key pair, i.e., a public key and a private key, in the card, or accesses a key pair previously generated in the card.
Parameters: |
|
---|
Hash the given data using the algorithm specified by the current Security environment.
Returns: | raw data (no TLV coding). |
---|
This method is used to store, restore or erase Security Environments or to manipulate the various parameters of the current SE. P1 specifies the operation to perform, p2 is either the SEID for the referred SE or the tag of a control reference template
Parameters: | p1 – Bitmask according to this table
|
---|
This methods parses a data field including Secure Messaging objects. SM_header indicates whether or not the header of the message shall be authenticated. It returns an unprotected command APDU
Parameters: |
|
---|---|
Returns: | Unprotected command APDU |
In the end this command is nothing but a big switch for all the other commands in ISO 7816-8. It will invoke the appropriate command and return its result
This method protects a response APDU using secure messaging mechanisms
Returns: | the protected data and the SW bytes |
---|
Verify a certificate send by the terminal using the internal trust anchors. This method is currently not implemented.
Verify the cryptographic checksum contained in the data field. Data field must contain a cryptographic checksum (tag 0x8E) and a plain value (tag 0x80)
Verify the digital signature contained in the data field. Data must contain a data to sign (tag 0x9A, 0xAC or 0xBC) and a digital signature (0x9E)