> 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/scra-dynafamily-programmers-manual/commands/file-operations-command-group-0xd8nn/start-send-file-to-device-secured-command-0xd811.md).

# Start Send File to Device (Secured) - Command 0xD811

The host uses this command to start sending secured files to the device for storage or processing. It is similar to **Start Send File to Device (Unsecured) - Command 0xD812**, but is used to send a different subset of file types that impact device security and require some form of authentication from the host. Refer to Table 206 to determine which file type requires a secure command. All files require the command to be authorized via a secure wrapper. In some cases, files include additional signatures within the file structure itself. This command is paired with **Start Get File from Device - Command 0xD821**, which the host can use to retrieve files. However, some file types are “one way only” and cannot be retrieved using that command after the host sends them to the device.

{% stepper %}
{% step %}

### Sequence of Events — Step 1

The host uses **Get Challenge - Command 0xE001** to establish a secure session with the device.
{% endstep %}

{% step %}

### Sequence of Events — Step 2

The host determines which file type it will send to the device (see **About Files**), and either opens an existing file in its file system for reading, or begins constructing it.
{% endstep %}

{% step %}

### Sequence of Events — Step 3

The host constructs **Start Send File to Device (Secured)**  - **Command 0xD811** per **Table XXX**.
{% endstep %}

{% step %}

### Sequence of Events — Step 4

The host constructs **Send Secured Command to Device - Command 0xEEEE** using the previously constructed command as the payload, and sends that command to the device as a **Request Message** to start the process of uploading a file.

Sub-steps and notes for building the secured wrapper:

* Use **Get Key Info - Command 0xEF11** to gather information about the key to use to secure the message payload(s). Because this command requires a MAC, use key slot 1111.
* Build the **Security Parameters Type** portion of the wrapper with:
  * Security Operation Type populated with the following values:
    * Operation Type = **Command Authorization Using MAC**
    * Operation Algorithm = CMAC
    * Operation Cipher = AES-256
    * Padding = One and zeros
    * **MAC Block Size** with any number
  * **Key Information Type** populated with the key information gathered earlier.
    {% endstep %}

{% step %}

### Sequence of Events — Step 5

The device sends a **Response Message** so the host knows it can begin sending the file.
{% endstep %}

{% step %}

### Sequence of Events — Step 6

The host sends a **Data File Message** to the device. If the device does not receive file data within a reasonable period of time, it times out and stops listening for the data file.
{% endstep %}

{% step %}

### Sequence of Events — Step 7

The device checks to make sure the **File ID** and the length and hash of the File Payload match with the values the host specified in this command.
{% endstep %}

{% step %}

### Sequence of Events — Step 8

The device repeats the same **Response Message**, this time with the **Message Reference Number** set to the same value the host used in the **Data File Message**.
{% endstep %}
{% endstepper %}

## Table SFDS-1 - Request Data for Start Send File to Device (Secured) - Command 0xD811

<table><thead><tr><th>Tag</th><th width="79.33331298828125">Len</th><th width="249.33331298828125">Value / Description</th><th width="74.33331298828125">Typ</th><th width="76">Req</th><th width="98">Default</th></tr></thead><tbody><tr><td>Beginning of any wrappers, at minimum including <strong>Request Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>D811 = <strong>Start Send File to Device (Secured) - Command 0xD811</strong></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>81</td><td>04</td><td>File ID from Table 206</td><td>B</td><td>R</td><td></td></tr><tr><td>A2</td><td>var</td><td>File transfer properties</td><td>T</td><td>R</td><td></td></tr><tr><td>/81</td><td>Var</td><td><p>Length of File Payload</p><p>This is the length of the <strong>File Payload</strong> parameter in the <strong>Data File Message</strong> the host sends to the device.</p></td><td>B</td><td>R</td><td></td></tr><tr><td>/82</td><td>01</td><td><p>Hash Checksum Type</p><ul><li>0x04 = SHA-256</li></ul></td><td>B</td><td>R</td><td></td></tr><tr><td>/83</td><td>20</td><td>Hash Checksum Anticipated checksum calculated against the <strong>File Payload</strong>, according to the standard specified in <strong>Hash Checksum Type</strong>.</td><td>B</td><td>R</td><td></td></tr><tr><td>A3</td><td>var</td><td>File Description The host should populate this value to help identify the file using <strong>Get File Info from Device</strong>. - <strong>Command 0xD825</strong></td><td>T</td><td>R</td><td></td></tr><tr><td>/81</td><td>var</td><td>File Name Maximum length 32 bytes Reserved for future use. Leave empty.</td><td>B</td><td>O</td><td>Null</td></tr><tr><td>/82</td><td>var</td><td>File Label Maximum length 16 bytes Reserved for future use. Leave empty.</td><td>B</td><td>O</td><td>Null</td></tr><tr><td>/83</td><td>var</td><td>File Version Maximum length 7 bytes Reserved for future use. Leave empty.</td><td>B</td><td>O</td><td>Null</td></tr><tr><td>/84</td><td>var</td><td>File Date Maximum length 20 bytes Reserved for future use. Leave empty.</td><td>B</td><td>O</td><td>Null</td></tr><tr><td>87</td><td>01</td><td>Reserved for future use. Leave empty.</td><td>B</td><td>O</td><td>Null</td></tr><tr><td>End of any wrappers, at minimum including <strong>Request Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

## Table SFDS-2 - Response Data for Command 0xD811 - Start Send File to Device (Secured)

<table><thead><tr><th>Tag</th><th width="74.3333740234375">Len</th><th>Value / Description</th><th width="76.33331298828125">Typ</th><th width="76.66668701171875">Req</th><th width="97.3333740234375">Default</th></tr></thead><tbody><tr><td>Beginning of any wrappers, at minimum including <strong>Response Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>D811 = <strong>Start Send File to Device (Secured) - Command 0xD811</strong> </td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>No parameters.</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>End of any wrappers, at minimum including <strong>Response Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

If the request started successfully, the Request Status in the message wrapper is **OK, Started / Running, All good / requested operation was successful**.

{% hint style="info" %}
For additional support, please contact MagTek Support.
{% endhint %}

## Table SFDS - 3 - Request Example

| Example (Hex)                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AA 00 81 04 01 04 D8 11 84 81 8F EE EE A1 19 81 05 03 03 06 02 08 84 00 85 00 A8 0A 81 02 11 02 82 00 86 00 88 00 A9 00 82 04 FF FF FF F0 83 08 C9 65 45 F2 97 69 85 B1 84 4E D8 11 81 04 00 00 03 00 A2 2B 81 04 00 00 02 99 82 01 04 83 20 87 A4 B3 54 61 C5 CB D3 1D DC BA 9D 65 25 5A D4 6A 22 FA 51 5E FD 65 87 AF AC A8 8C 4F AF 80 9B A3 14 38 31 30 38 33 30 33 30 33 30 33 30 33 33 33 30 33 30 87 01 01 9E 10 7D E4 27 C8 A0 70 72 08 19 0A 1E 0A 3F 48 BB F1 |

## Table SFDS-5 - Response Example

| Example (Hex)                             |
| ----------------------------------------- |
| AA 00 81 04 82 0C D8 11 82 04 00 00 00 00 |


---

# 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/scra-dynafamily-programmers-manual/commands/file-operations-command-group-0xd8nn/start-send-file-to-device-secured-command-0xd811.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.
