> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/api-and-command-reference/7-30-26-draft-version-scra-dynafamily-programmers-manual/7-30-26-draft-version-data-types-and-shared-tlv-data-objects/7-30-26-draft-version-certificate-store.md).

# (7/30/26 Draft Version) Certificate Store

<table data-header-hidden><thead><tr><th width="90" valign="top"></th><th width="75" valign="top"></th><th width="96" valign="top"></th><th width="89" valign="top"></th><th width="113" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Secured</td><td valign="top"><p>File</p><p>Type</p></td><td valign="top"><p>File Type</p><p>Version</p></td><td valign="top"><p>File</p><p>Subtype</p></td><td valign="top"><p>File</p><p>Index</p></td><td valign="top">Remark</td></tr><tr><td valign="top"><p>Get: N/A</p><p>Set: No</p></td><td valign="top">0x0A</td><td valign="top">0x00</td><td valign="top">0x00</td><td valign="top">0x00</td><td valign="top">Subtype 0=VICAL File (>= 20 certificates, Max 30), File Index is 0x00.</td></tr><tr><td valign="top"><p>Get: N/A</p><p>Set: Yes</p></td><td valign="top">0x0A</td><td valign="top">0x00</td><td valign="top">0x01</td><td valign="top">0x00–0x0E</td><td valign="top">Subtype 1=Certificates, provided by DMVs, Apple, Google, etc. Max 15 files.</td></tr><tr><td valign="top"><p>Get: No</p><p>Set: N/A</p></td><td valign="top">0x0A</td><td valign="top">0x00</td><td valign="top">0x02</td><td valign="top">0x00</td><td valign="top">Subtype 2=Cert Store Table</td></tr></tbody></table>

### Send File    &#x20;

* 0xD811 (Secured)     &#x20;
* 0xD812 (Unsecured)

**Host App may send the following files to the device:**

{% code overflow="wrap" %}

```
a)       File ID:0A-00-00-00                          // VICAL file
b)       File ID:0A-00-01-00 to 0A-00-01-0E           // Individual files
```

{% endcode %}

### Fetch File

* 0xD821                     &#x20;

**Host App may fetch the following files from the device:**

{% code overflow="wrap" %}

```
a)       File ID:0A-00-02-00                         // CERT Store Table
```

{% endcode %}

### Delete File

* 0xD831         &#x20;

**Host App may delete the following files from the device:**

{% code overflow="wrap" %}

```
a)       File ID:0A-00-00-00                // VICAL file
b)       File ID:0A-00-01-00 to 0A-00-01-0E // Individual files
c)       File ID:0A-00-02-00                // CERT Store Table
```

{% endcode %}

{% hint style="info" %}
**NOTE 1:** If users delete the VICAL file (0A-00-00-00), then FW will delete all the VICAL certificates.

**NOTE 2:** If users delete the CERT Store Table file (0A-00-02-00), then FW will delete all the certificates.

**Example:** 0xD831 command string to delete CERT Store Table

For AB4.10 & older images: Use File ID: 0A-00-01-00

For AB4.11 & newer images: Use File ID: 0A-00-02-00

AA0081040105D8318408D83181040A000100             // for AB4.10 & older images

AA 00                                                                               // Header

81 04 01 05 D8 31                                                            // P1, 0xD831 Command, Msg ID 05

84 08 D8 31                                                                     // P4, Len=8

81 04 0A 00 01 00                                                           // P4->P1, File ID=0x0A000100
{% endhint %}

### Script file to load certificate to unit

**Example #1**

{% code overflow="wrap" %}

```
Write vical_4_2_2026.cbor as File ID: 0A-00-00-00 to the unit Unsecured (0xD812)
```

{% endcode %}

The subtype 0x00 VICAL certificates will be loaded into the unit, starts from entry #00 to #29.

{% code overflow="wrap" %}

```
SendFile00 = data:{$SendFile(0A000000,$LoadFile(C:\Doc\mDL\Cert-Loading\certs\ vical_4_2_2026.cbor))}
```

{% endcode %}

**Example #2**

{% code overflow="wrap" %}

```
Write file_00.der as File ID: 0A-00-01-00 to the unit Secured (0xD811)
```

{% endcode %}

The subtype 0x01 individual certificates will be loaded into the unit, starts from entry #30 to #44.

{% code overflow="wrap" %}

```
SendFile1E = data:{$SendFile(0A000100,$LoadFile(C:\Doc\mDL\Cert-Loading\certs\file_00.der),MAC)}
```

{% endcode %}

### The data structures of CERT\_STORE\_T

The size of an entry (CERT\_REC\_T) is 32 bytes, so the entire store (CERT\_STORE\_T) has 32x45 = 1440 bytes.

{% code overflow="wrap" %}

```
typedef struct
{
    uint16_t year;
    uint16_t mon;
    uint8_t  day;
    uint8_t  hour;
    uint8_t  min;
    uint8_t  sec;
} MDL_CERT_TIME;

typedef struct                  // 32 bytes total
{
    uint8_t  status[2];          // ACTIVE or empty
    uint8_t  ski[8];             // subject key identifier
    uint8_t  region[6];          // example: US-CA
    MDL_CERT_TIME from_time;     // not before time in RTC format
    MDL_CERT_TIME to_time;       // not after time in RTC format
} CERT_REC_T;

#define CERT_STORE_MAX_CNT       45      // the max number of entries in CERT Store

typedef struct
{
    CERT_REC_T entry[CERT_STORE_MAX_CNT];
} CERT_STORE_T;
```

{% endcode %}

Host Application may fetch the file of “Certificate Store Table” with File ID:0A-00-02-00. Then, decode and display the contents of the file as follows: (4 certificates in this case)

Scanning input file: cert\_table.bin.

* The input file size = 1440 bytes.
* Data Structure & File Size match.

### CERT Store Operation Table\[45] =

{% code overflow="wrap" %}

```
--Index:  00     Region: US-MD
  Status: 01-00  SKI: 4E9AD1CDA1412754
  FROM: 2024-01-05 05:00:00  TO: 2029-01-04 05:00:00
```

{% endcode %}

{% code overflow="wrap" %}

```
--Index:  01     Region: US-UT
  Status: 01-00  SKI: 3C4C6CDFE782342E
  FROM: 2023-12-18 12:25:47  TO: 2032-12-15 12:25:46
```

{% endcode %}

{% code overflow="wrap" %}

```
--Index:  03     Region: US-VA
  Status: 01-00  SKI: 9614BCEB5DD9FBBB
  FROM: 2025-07-22 13:26:02  TO: 2027-07-22 13:26:01
```

{% endcode %}

{% code overflow="wrap" %}

```
--Index:  26     Region: US-CA
  Status: 01-00  SKI: BB7D7567927A6FCF
  FROM: 2023-03-01 17:17:39  TO: 2033-01-07 17:17:39
```

{% endcode %}

&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.magtek.com/api-and-command-reference/7-30-26-draft-version-scra-dynafamily-programmers-manual/7-30-26-draft-version-data-types-and-shared-tlv-data-objects/7-30-26-draft-version-certificate-store.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
