11.12.3.4.62. Function Se05x_API_CreateCounter

11.12.3.4.62.1. Function Documentation

smStatus_t Se05x_API_CreateCounter(pSe05xSession_t session_ctx, pSe05xPolicy_t policy, uint32_t objectID, uint16_t size)

Se05x_API_CreateCounter

Creates a new counter object.

Counters can only be incremented, not decremented.

When a counter reaches its maximum value (e.g., 0xFFFFFFFF for a 4-byte counter), they cannot be incremented again.

An input value (TAG_3) must always have the same length as the existing counter (if it exists); otherwise the command will return an error.

Command to Applet

Field

Value

Description

P1

P1_COUNTER

See SE05x_P1_t

P2

P2_DEFAULT

See SE05x_P2_t

Payload

TLV[TAG_POLICY]

Byte array containing the object policy. [Optional: default policy applies] [Conditional: only when the object identifier is not in use yet]

TLV[TAG_1]

4-byte counter identifier.

TLV[TAG_2]

2-byte counter size (1 up to 8 bytes). [Conditional: only if object doesn’t exist yet and TAG_3 is not given]

TLV[TAG_3]

Counter value [Optional: - if object doesn’t exist: must be present if TAG_2 is not given. - if object exists: if not present, increment by 1. if present, set counter to value.]

R-APDU Body

NA

R-APDU Trailer

NA

Parameters
  • [in] session_ctx: Session Context [0:kSE05x_pSession]

  • [in] policy: policy [1:kSE05x_TAG_POLICY]

  • [in] objectID: object id [2:kSE05x_TAG_1]

  • [in] size: size [3:kSE05x_TAG_2]