capturePIN

abstract fun capturePIN(tInputCapturePin: TypeInputCapturePin): TypeOutputCapturePin

Securely captures a PIN from the user, encrypts it using a specified key, and writes the resulting PIN block into baPinBlock.

This function manages user PIN entry under secure conditions, including length restrictions, audible feedback, and timeouts.

Be aware that if the DUKPT encryption method was selected, for security purposes, this method MUST advance the KSN right after the encryption the pin block.

Parameters

eKeyType

The type of key to use for encryption (CryptoKeyType).

iKeyIndex

The index of the key to use (0–99).

baSessionKey

Optional session key (required for MK/SK; ignored for DUKPT).

baPan

Primary Account Number (PAN), used for PIN block formatting.

iMaxPinLength

Maximum allowed PIN length (inclusive).

iMinPinLength

Minimum allowed PIN length (inclusive).

blIsKBDSoundEnabled

Enables keypad audio feedback if true.

iTimeout

Timeout (in seconds) for entry of each PIN digit.

iTotalTimeout

Overall timeout (in seconds) for the entire PIN entry process.

blIsBypassEnabled

If true, allows PIN bypass; otherwise, PIN entry is mandatory.

sPinCaptureMessage

Message to display to the user during PIN entry.

baPinBlock

Output array to receive the encrypted PIN block; must be sized according to expected block length.

Throws

If PIN entry or encryption fails (e.g., timeouts, invalid parameters, missing key).