> 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/security-command-group-0xennn/generate-csr-keys-wlan-only-command-0xef02.md).

# Generate CSR Keys (WLAN Only) - Command 0xEF02

The host uses this command to generate a key pair to be used for a certificate signing request (CSR). The key pair generated will be 256 bit elliptic-curve (EC) keys. The key pair generated will be saved to non-volatile memory in the device and will overwrite any existing CSR key pair. The key pair will persist in non-volatile memory associated with a CSR until it is either overwritten or until a leaf certificate is loaded into the device with **Start Send File to Device (Secured) - Command 0xD811** that contains a public key that matches the key pair at which point the key pair will be associated with that certificate instead of a CSR.

The sequence of events is as follows:

{% stepper %}
{% step %}

### Host sends command request

The host constructs the command request in the format below and sends it to the device.
{% endstep %}

{% step %}

### Device sends immediate response

The device sends a response in the format below to the host to indicate that key pair generation has been started.
{% endstep %}

{% step %}

### Device sends notification when generation completes

Once the device finishes generating the key pair, it will send **Device Information Update - Notification 0x1001** with the category set to key management and the reason set to CSR keys generated to indicate that the key pair generation process has completed.

The device typically takes around a second or two to generate a 256 bit EC key pair. If this command is extended in the future to support 2048 bit RSA keys, then it will take an average of 30 seconds and sometimes much longer to generate the RSA keys. That is why a notification is used to indicate that the key pair has been generated instead of a command response that indicates that it is complete.
{% endstep %}

{% step %}

### Host typically requests CSR next

The host will typically send **Generate CSR (WLAN Only) - Command 0xEF03** as the next step. See that command for more detail and more potential steps.
{% endstep %}
{% endstepper %}

## Table GCKW-1 - Generate CSR keys (WLAN Only) - Request Data for Command 0xEF02

<table><thead><tr><th width="233.33331298828125">Tag</th><th width="75.33331298828125">Len</th><th>Value / Description</th><th width="74.3333740234375">Typ</th><th width="77.33331298828125">Req</th><th width="96.6666259765625">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>EF02 = <strong>Generate CSR keys (WLAN Only) - Command 0xEF02</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>Request Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

## Table GCKW-2 - Response Data for Generate CSR keys (WLAN Only) - Command 0xEF02

<table><thead><tr><th>Tag</th><th width="74">Len</th><th>Value / Description</th><th width="77.3333740234375">Typ</th><th width="74.6666259765625">Req</th><th width="96.6666259765625">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>EF02 = <strong>Generate CSR keys (WLAN Only) - Command 0xEF02</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>

## Table GCKW-3 - Request Example

{% code title="Example (hex)" %}

```
AA00 81 04 0155EF02 84 02 EF02
```

{% endcode %}

## Table GCKW-4 - Response Example

Example (Hex):

```
AA00 81 04 8205EF02 82 04 01000000 84 02 EF02
```


---

# 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/security-command-group-0xennn/generate-csr-keys-wlan-only-command-0xef02.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.
