Developer Wiki / Cards / secure operations

Card and secure modules

Separate ICC, PICC, magnetic-stripe, PIN and secure-element work from ordinary application code and logs.

Start the stepsBack to Wiki

By the end

A security boundary and test plan that makes ownership, sensitive data and approval gates explicit.

For Payment, identity and secure-card integration teams working with approved hardware and credentials.

Before you start

Keep the first test small and repeatable.

ModuleCards / secure operations
LevelAdvanced
AudiencePayment, identity and secure-card integration teams working with approved hardware and credentials.
  • An approved security owner and a defined test fixture or card set.
  • A clear boundary for keys, PINs, APDU data, certificates and payment host integration.
  • A private test environment with redacted logs and no customer credentials.

Step by step

Build it in 4 deliberate passes.

Each pass produces a checkable result. Keep device-specific calls in the adapter and keep the workflow portable.

  1. 01

    Name the card and security boundary

    ICC, PSAM, PICC, magnetic stripe, PIN pad and secure element are different workflows. Record card type, slot, protocol, owner and target device instead of calling everything “card support”.

  2. 02

    Keep secrets outside the demo

    Use opaque test handles and redacted outcomes in the public pattern. Keys, PIN blocks, track data, KSN values, certificates and customer fixtures stay in the approved private integration.

  3. 03

    Make activation and release symmetrical

    Activate one session, validate the response length and status, then deactivate in a finally path. A failed transaction must not leave a card or secure module open.

  4. 04

    Require security review before hardware claims

    The local SDK samples are useful for module discovery, but they do not establish compliance, payment approval or production compatibility. Those claims need a separate evidence record.

Copyable pattern / Kotlin

Start with the boundary, then bind the device.

This deliberately uses an opaque test handle. It is not a payment implementation and does not contain keys or credentials.

secure-port.kt

data class SecureRequest(
  val operation: String,
  val testHandle: String,
)

sealed interface SecureResult {
  data object Accepted : SecureResult
  data class Declined(val reason: String) : SecureResult
  data class Failed(val reason: String) : SecureResult
}

interface SecurePort {
  suspend fun execute(request: SecureRequest): SecureResult
}

suspend fun executeApprovedOperation(port: SecurePort): SecureResult =
  runCatching {
    port.execute(SecureRequest("approved-test", "fixture-01"))
  }.getOrElse {
    SecureResult.Failed("secure-operation-failed")
  }
Original pattern. No vendor binary is included on this page.

When the happy path breaks

Make recovery part of the first implementation.

Operators experience the failure state, not the API call. Translate device signals into a useful next action.

Unexpected response length or status

Discard the response from the public workflow, record a redacted failure and release the session.

A secret appears in logs or fixtures

Stop the test, rotate the affected credential and remove the artifact from the test environment.

The device module differs by model

Split the compatibility record and request a device-specific security review.

Before you ship

Use this checklist on the target configuration.

  1. 01

    Use approved test credentials and fixtures only in a private environment.

  2. 02

    Verify activation, success, timeout, failure and release paths.

  3. 03

    Run a redacted-log scan before sharing any report or sample.

  4. 04

    Record the security owner, device, firmware, SDK and approval scope.

Next step: Request a scoped device and security review before publishing a card or payment integration.

Further reading

Use platform guidance for the parts the device SDK does not own.

These references cover Android lifecycle, broadcast, testing and architecture patterns. Device-specific compatibility still needs a model-level validation record.

Need the exact device binding?

Bring the model, workflow and app build. We will scope the validation.

Validate my application