PACEMapping
internal enum PACEMapping
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 cipher E() and a derived key Kπ.
This nonce is then mapped to a random generator using an algorithm-specific mapping function Map.
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, wherehis calculated by anonymous Diffie-Hellman Key Agreement. - Using ECDH:
Ĝ = s × G + H, whereHis 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.
-
Generic Mapping
Declaration
Swift
case GM -
Integrated Mapping
Declaration
Swift
case IM -
Chip Authentication Mapping
Declaration
Swift
case CAM -
Maps the nonce to a random generator using the specified algorithm-specific mapping function and key agreement algorithm.
Throws
An error if mapping is not yet supported or if mapping fails.
Important
The returned reference must be freed by the caller after use. The pointer will reference a
EVP_KEYstructure (so useEVP_PKEY_freethen).Declaration
Swift
internal static func map( nonce: OpaquePointer, sharedSecret: OpaquePointer, config: OpaquePointer, with mapping: PACEMapping, using algorithm: KeyAgreementAlgorithm ) throws -> OpaquePointerParameters
nonceThe decrypted nonce from the IC.
sharedSecretThe shared secret/key computed with a
KeyAgreementAlgorithmfor mapping.configThe current structure containing Key Agreement Algorithm data.
mappingThe mapping function to use.
algorithmThe
KeyAgreementAlgorithmto use.Return Value
A reference to the new mapped parameters data structure for use in subsequent Key Agreement Algorithm operations.
-
Maps the nonce to a random generator using the specified algorithm-specific mapping function and key agreement algorithm.
Throws
An error if mapping is not yet supported or if mapping fails.
Important
The returned reference must be freed by the caller after use. The pointer will reference a
EVP_KEYstructure (so useEVP_PKEY_freethen).Declaration
Swift
internal func map( nonce: OpaquePointer, sharedSecret: OpaquePointer, config: OpaquePointer, using algorithm: KeyAgreementAlgorithm ) throws -> OpaquePointerParameters
nonceThe decrypted nonce from the IC.
sharedSecretThe shared secret/key computed with a
KeyAgreementAlgorithmfor mapping.configThe current structure containing Key Agreement Algorithm data.
algorithmThe
KeyAgreementAlgorithmto use.Return Value
A reference to the new mapped parameters data structure for use in subsequent Key Agreement Algorithm operations.
View on GitHub
PACEMapping Enumeration Reference