Cryptnox Docs

Get Card Info - Read Data Command

This command is used to retrieve structured metadata and user-defined content from the card’s secure memory. This includes card ownership details, cryptographic key source information, public keys, and any additional user-defined data written using the WRITE DATA command.


def get_card_info(pk_user_idx: int): card.get_card_info(pk_user_idx) # For example: get_card_info(1)

📘

Note

  • The secure channel must be open for all usages of this command. PIN or challenge-response authentication is required for reading key slots and user data slots (P2 > 0). d.
  • PIN or challenge-response authentication is required for reading key slots and user data slots (P2 > 0).

Application Protocol Data Unit (APDU) Components

The following table outlines the components of the Application Protocol Data Unit (APDU).

Field

Description

Value

CLA

This field specifies the class of the instruction.

0x80

INS

This field specifies the particular command or operation that the smart card or secure element should execute.

0xFA

P1

First parameter of the instruction that specifies the details about the operation being requested.

0x00 to 0x03

P2

First parameter of the instruction that specifies additional details about the operation being requested.

0x00 to 0x03

Data

Key data

None

Data Retrieval Modes

ConditionData Value
P1=0 & P2=0

provides the following data :

  • Keys source info (1 byte, see below)
  • Owner Name (prepended with a LEN byte)
  • Owner Email (prepended with a LEN byte)
  • Signature counter (4 bytes, big endian)

Keys source info byte :

  • x00 : No key (not seeded)
  • ‘K’ : A single 256k1 EC pair was loaded
  • ‘X’ : An extended 256k1 key was loaded (a BIP32 node)
  • ‘L’ : An external seed was loaded
  • ‘S’ : Internal seed generated
  • ‘D’ : Seed generated using dual generation mode (with an other paired card)
P1>0 (1-3) & P2=0

Provides the 64 bytes description data and the public key user slot (64 bytes info + 65/256 bytes public key). This requires PIN or challenge-response. These data were provided with ADD USER KEY.

P2=1,2,3

Provides the data in the user data slot. This requires PIN or challenge-response.

This is P2=1 increased by the page index (page is 1200 bytes long). This data was provided by the Write Data command 0xFC.

📘

Note

When reading user data with this command, the command must be sent using the extended frame format header, to receive bigger than 256 bytes data (even if the command frame length is shorter). This is as expected by the ISO7816 standard.

Response

The following table outlines the possible responses that you will receive:

Response Code

Description

0x9000

Success

0x6985

secure channel not opened or

PIN/challenge

not validated (P2=1)

0x6B00

invalid P1/P2 or user data

slot reading out of range