set Contactless CAPKs
Loads one CAPK (Certificate Authority Public Key) into the contactless EMV kernel CAPK Buffer.
This method adds a single Certificate Authority Public Key to the internal buffer for contactless EMV transactions. CAPKs are essential for EMV offline data authentication, enabling the terminal to verify the authenticity of card data without requiring online authorization. Each CAPK is associated with a specific payment scheme (identified by RID) and has a unique index.
Prerequisites:
EMV kernel environment must be initialized via initializeKernelEnvironment
Contactless kernel must be properly configured
CAPK data structure: The TypePublicKeyModal typically contains the following EMV tags:
9F06 (AID/RID): Application/Registered Identifier specifying the payment scheme
9F22 (CA Public Key Index): Unique identifier for this CAPK within the RID
DF02 (Modulus): RSA public key modulus for cryptographic operations
DF04 (Exponent): RSA public key exponent (typically 3 or 65537)
DF05 (Hash Value): Hash of the modulus and exponent for integrity verification
Usage sequence: This method is part of a multi-step contactless CAPK loading process:
Call this method multiple times to load all required contactless CAPKs
Call endContactlessCAPKLoad to finalize and commit all loaded CAPKs to the kernel
Thread safety: This method should be called from a single thread during the CAPK loading sequence to ensure data consistency and prevent buffer corruption.
Exceptions: This function MUST NOT throw any exception. Any error must be indicated through NexusRet Any unexpected error must be mapped as NexusRet.INTERR
Return
NexusRet indicating the CAPK loading result:
NexusRet.OK: CAPK data loaded successfully into the buffer
NexusRet.INTERR: Internal error during CAPK loading
Other values: Specific TLV parsing errors, data validation errors, or kernel failures
Example usage:
val result = emvPort.setContactlessCAPKs(visaContactlessCAPK)
if (result == NexusRet.OK) {
println("VISA contactless CAPK loaded successfully")
}Timber log suggestion: Log RID, CAPK index, and loading status for audit purposes.
Parameters
A TypePublicKeyModal object containing the complete CAPK data for contactless transactions. This includes the RID, CAPK index, RSA modulus, exponent, hash, and other cryptographic parameters required for contactless EMV offline data authentication.