11.12.3.4.111. Function Se05x_API_ReadObject

11.12.3.4.111.1. Function Documentation

smStatus_t Se05x_API_ReadObject(pSe05xSession_t session_ctx, uint32_t objectID, uint16_t offset, uint16_t length, uint8_t *data, size_t *pdataLen)

Se05x_API_ReadObject

Reads the content of a Secure Object.

  • If the object is a key pair, the command will return the key pair’s public key.

  • If the object is a public key, the command will return the public key.

  • If the object is a private key or a symmetric key or a userID, the command will return SW_CONDITIONS_NOT_SATISFIED.

  • If the object is a binary file, the file content is read, giving the offset in TLV[TAG_2] and the length to read in TLV[TAG_3]. Both TLV[TAG_2] and TLV[TAG_3] are bound together; i.e.. either both tags are present, or both are absent. If both are absent, the whole file content is returned.

  • If the object is a monotonic counter, the counter value is returned.

  • If the object is a PCR, the PCR value is returned.

  • If TLV[TAG_4] is filled, only the modulus or public exponent of an RSA key pair or RSA public key is read. It does not apply to other Secure Object types.

Command to Applet

Field

Value

Description

CLA

0x80

INS

INS_READ

See SE05x_INS_t, in addition to INS_READ, users can set the INS_ATTEST flag. In that case, attestation applies.

P1

P1_DEFAULT

See SE05x_P1_t

P2

P2_DEFAULT

See SE05x_P2_t

Lc

#(Payload)

Payload Length.

TLV[TAG_1]

4-byte object identifier

TLV[TAG_2]

2-byte offset [Optional: default 0] [Conditional: only when the object is a BinaryFile object]

TLV[TAG_3]

2-byte length [Optional: default 0] [Conditional: only when the object is a BinaryFile object]

TLV[TAG_4]

1-byte SE05x_RSAKeyComponent_t: either RSA_COMP_MOD or RSA_COMP_PUB_EXP. [Optional] [Conditional: only for RSA key components]

Le

0x00

R-APDU Body

Value

Description

TLV[TAG_1]

Data read from the secure object.

R-APDU Trailer

SW

Description

SW_NO_ERROR

The read is done successfully.

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

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

  • [in] offset: offset [2:kSE05x_TAG_2]

  • [in] length: length [3:kSE05x_TAG_3]

  • [out] data: [0:kSE05x_TAG_1]

  • [inout] pdataLen: Length for data