IC Access
-
The
BACHandler
class acts as a handler for Basic Access Control (BAC), which allows access to the contactless Integrated Circuit (IC) of an eMRTD by implementing a Chip Access Control mechanism.BAC is a cryptographic protocol that enables the inspection system to prove its authorization to access the contactless IC using information derived from the physical document, such as the Machine Readable Zone (MRZ) information.
The BAC mechanism is purely based on symmetric cryptography and provides protection against skimming, misuse and eavesdropping during communication between the eMRTD and the inspection system.
Protocol Specification
Authentication and Key Establishment is provided by a three-pass challenge-response protocol according to ISO/IEC 11770-2 Key Establishment Mechanism 6 using 3DES [FIPS 46-3] as block cipher. A cryptographic checksum according to ISO/IEC 9797-1 MAC Algorithm 3 is calculated over and appended to the ciphertexts. Exchanged nonces MUST be of size 8 bytes, exchanged keying material MUST be of size 16 bytes. The IFD (i.e. the inspection system) and the contactless IC MUST NOT use distinguishing identifiers as nonces.
Cryptographic Specifications
Encryption of Challenge and Response: Two-key 3DES in CBC mode with zero IV is used for computation of EIFD and EIC. Padding for the input data must not be used when performing the EXTERNAL AUTHENTICATE command.
Authentication of Challenge and Response: Cryptographic checksums MIFD and MIC are calculated using ISO/IEC 9797-1 MAC Algorithm 3 with block cipher DES and zero IV, following ISO/IEC 9797-1 padding method 2. The MAC length is 8 bytes.
See also
Declaration
Swift
internal final class BACHandler
-
The
DocumentBasicAccessKeys
class represents the Document Basic Access Keys derived from the Machine Readable Zone (MRZ) key.These keys are used for encryption (Kenc) and message authentication (Kmac) in Basic Access Control (BAC). The MRZ key is hashed using SHA-1, and the key seed is generated from the hash. The final keys Kenc and Kmac are derived using a key derivation mechanism with the key seed.
Note
The
BACHandler
class use these keys to establish access to the IC.See also
Declaration
Swift
internal final class DocumentBasicAccessKeys
-
PACEHndler
is responsible for performing PACE access control protocol to allow the access to the IC.PACE is a password authenticated Diffie-Hellman key agreement protocol that provides secure communication and password-based authentication of the eMRTD chip and the inspection system, i.e. eMRTD chip and inspection system share the same password.
Note
PACE establishes
NFCSecureSession
between an eMRTD chip and an inspection system based on weak (short) passwords.See also
CardAccess
,SecurityInfo
,PACEInfo
,PACESecurityProtocol
PACEMapping
,PACEParametersDecoder
,KeyAgreementAlgorithm
andNFCSecureSession
Declaration
Swift
internal final class PACEHandler
-
The
PACEInfo
class represents security information related to the Password Authenticated Connection Establishment (PACE) protocol used for access the IC and secure communication with an eMRTD chip.PACE is used to protect sensitive data exchanges in electronic passports. This class provides details about the specific PACE protocol used, including version and domain parameters.
The ASN.1 data structure
PACEInfo
is defined as follows:PACEInfo ::= SEQUENCE { protocol OBJECT IDENTIFIER( id-PACE-DH-GM-3DES-CBC-CBC | id-PACE-DH-GM-AES-CBC-CMAC-128 | id-PACE-DH-GM-AES-CBC-CMAC-192 | id-PACE-DH-GM-AES-CBC-CMAC-256 | id-PACE-ECDH-GM-3DES-CBC-CBC | id-PACE-ECDH-GM-AES-CBC-CMAC-128 | id-PACE-ECDH-GM-AES-CBC-CMAC-192 | id-PACE-ECDH-GM-AES-CBC-CMAC-256 | id-PACE-DH-IM-3DES-CBC-CBC | id-PACE-DH-IM-AES-CBC-CMAC-128 | id-PACE-DH-IM-AES-CBC-CMAC-192 | id-PACE-DH-IM-AES-CBC-CMAC-256 | id-PACE-ECDH-IM-3DES-CBC-CBC | id-PACE-ECDH-IM-AES-CBC-CMAC-128 | id-PACE-ECDH-IM-AES-CBC-CMAC-192 | id-PACE-ECDH-IM-AES-CBC-CMAC-256 | id-PACE-ECDH-CAM-AES-CBC-CMAC-128 | id-PACE-ECDH-CAM-AES-CBC-CMAC-192 | id-PACE-ECDH-CAM-AES-CBC-CMAC-256), version INTEGER, -- MUST be 2, parameterId INTEGER OPTIONAL }
This data structure provides detailed information on an implementation of PACE and its components represent:
protocol
: An object identifier that identifies the algorithms to be used (i.e. key agreement, symmetric cipher and MAC).version
: An integer that identifies the version of the protocol. Currently, only version 2 is supported by this specification.parameterId
: An integer that is used to indicate the domain parameter identifier (optional).
Important
parameterId
must be used if the eMRTD chip usesStandardizedDomainParameters
, provides multiple explicit domain parameters for PACE or protocol is one of the*-CAM-*
OIDs.Important
In case of PACE with Chip Authentication Mapping, the
parameterId
also denotes the identifier of the Chip Authentication key used, i.e. the IC must provide aChipAuthenticationPublicKeyInfo
withkeyId
equal toparameterId
from this data structure.Note
It inherits from the
SecurityInfo
class.See also
PACESecurityProtocol
,PACEParametersDecoder
,PACEMapping
,PACEHandler
, andStandardizedDomainParameters
Declaration
Swift
internal final class PACEInfo : SecurityInfo
-
PACEMapping
manages the possible algorithm-specific mapping functions used during the PACE security protocol for accessing the contactless IC.In PACE, a nonce
s
is encrypted using a chosen block cipherE()
and a derived keyKπ
. This nonce is then mapped to a random generator using an algorithm-specific mapping functionMap
.PACE supports three mapping functions:
Generic Mapping (GM): This mapping uses either DH or ECDH. The function
Map:g → ĝ
is defined differently for DH and ECDH:- Using DH:
ĝ = g^s * h
, whereh
is calculated by anonymous Diffie-Hellman Key Agreement. - Using ECDH:
Ĝ = s × G + H
, whereH
is calculated by anonymous EC Diffie-Hellman Key Agreement.
- Using DH:
Integrated Mapping (IM): IM uses either DH or ECDH. It utilizes a pseudo-random function
Rp(s,t)
and a functionf_g(x)
to map nonces to group elements.Chip Authentication Mapping (CAM): The mapping phase of PACE-CAM is identical to PACE-GM.
Important
The description includes high-level details of PACE mapping. For precise specifications, consult relevant standards documents.
See also
PACEInfo
,PACESecurityProtocol
,PACEParametersDecoder
,PACEHandler
,StandardizedDomainParameters
andKeyAgreementAlgorithm
Declaration
Swift
internal enum PACEMapping
-
The
See morePACEParametersDecoder
class is responsible for decodingStandardizedDomainParameters
used during PACE based on their identifiers.Declaration
Swift
internal final class PACEParametersDecoder
-
The
PACESecurityProtocol
enum represents various security protocols used in PACE for electronic Machine Readable Travel Documents (eMRTD).These protocols are identified by a unique
ObjectIdentifier
(OID) and specificEncryptionAlgorithm
,KeyAgreementAlgorithm
andPACEMapping
function.See also
PACEInfo
,PACEMapping
,PACEParametersDecoder
PACEHandler
,KeyAgreementAlgorithm
andEncryptionAlgorithm
Declaration
Swift
internal enum PACESecurityProtocol : UInt8, SecurityProtocol