IXsecCallback

interface IXsecCallback

Unified external security (xsec) callback interface.

One method prefix per moka module: rdr (reader, rng (random number generation), sred (sensitive data), hsm (CA public key store).

Every method has a default implementation, so an implementer only needs to override the methods it actually cares about:

  • A reader-only implementation (e.g. the "std" build, or a third-party DSEC integrator) typically overrides only rdrDetectCardInterface, rdrExchangeApdu and rdrActivate (and rdrCancelTagDetection if cancellation support is available).

  • A full security-module implementation (e.g. the "xsec" build) overrides every method, forwarding each one to its own security bridge.

Since

1.5.0

Inheritors

Functions

Link copied to clipboard
open fun hsmFlushCaKeys()

Clears all CA public keys.

Link copied to clipboard
open fun hsmGetCaKey(inbound: ByteArray): ByteArray

Gets a CA public key modulus and exponent for a RID and CAPK index.

Link copied to clipboard

Checks CAPK index presence.

Link copied to clipboard
open fun hsmStoreCaKey(inbound: ByteArray)

Registers a CA public key for a RID.

Link copied to clipboard
abstract fun rdrActivate()

Activate contactless card (EMV Level 1).

Link copied to clipboard

Cancels an in-progress rdrDetectCardInterface call.

Link copied to clipboard
abstract fun rdrDetectCardInterface(supportedInterface: Int, timeout: Int): Int

Performs card detection (swipe, instert & tap) on all supported interfaces until timeout.

Link copied to clipboard

Detection potential contactless card collision (EMV Level 1).

Link copied to clipboard
abstract fun rdrExchangeApdu(command: ByteArray): ByteArray

Sends an APDU command to the card and waits for a response.

Link copied to clipboard
open fun rdrGetCardStatus(): Int

Returns the current card status.

Link copied to clipboard
Link copied to clipboard
open fun rdrPowerOff()

Powers card off.

Link copied to clipboard
open fun rdrPowerOn(): Pair<Int, ByteArray?>

Powers card on.

Link copied to clipboard
open fun rdrRemove(holdTime: Int)

Performs contactless card removal (EMV Level 1).

Link copied to clipboard
open fun rdrResetAntenna()

Reset contactless card antenna (EMV Level 1).

Link copied to clipboard
open fun rdrSwitchAntenna(onOff: Boolean)

Switch antenna on or off.

Link copied to clipboard
open fun rngGetRandom(len: Int, range: Int): ByteArray

Retrieves a len bytes random with each byte in the range 0-range

Link copied to clipboard

Compute SSD SHA.

Link copied to clipboard

Extract PAN and Expiration date.

Link copied to clipboard

Retrieves DD from Track1 data.

Link copied to clipboard

Retrieves DD from Track2 data.

Link copied to clipboard
open fun sredGetIccKey(inbound: ByteArray): ByteArray

ICC key request.

Link copied to clipboard

Issuer key request.

Link copied to clipboard
open fun sredSetSignedRecord(inbound: ByteArray)

Sets signed record.

Link copied to clipboard

Stores the Relay Resistance Protocol (RRP) results into track 2 equivalent data (tag 57).

Link copied to clipboard

Exchanges a C-APDU/R-APDU pair with the loaded virtual card script.

Link copied to clipboard

Gets the interface the virtual card is currently presented on.

Link copied to clipboard

Gets the current virtual card status.

Link copied to clipboard
open fun vcardLoad(inbound: ByteArray)

Loads a virtual card script.

Link copied to clipboard
open fun vcardPresent()

Presents the virtual card (consumes the next presentation tag in the loaded script).

Link copied to clipboard
open fun vcardRemove()

Removes the virtual card.

Link copied to clipboard
open fun vcardUnload()

Unloads the current virtual card script.