# otCryptoKey Struct Reference

# otCryptoKey


`#include <openthread/platform/crypto.h>`

Represents the Key Material required for Crypto operations.

## Summary

| ### Public attributes ||
|---|---|
| `https://openthread.io/reference/struct/ot-crypto-key#structot_crypto_key_1a1ce6ade6ae8e5fafc4ecd89bab2cf7c1` | `const uint8_t *` Pointer to the buffer containing key. NULL indicates to use `mKeyRef`. |
| `https://openthread.io/reference/struct/ot-crypto-key#structot_crypto_key_1adbf84bc1a8bff9397f9dfb69778f03e0` | `uint16_t` The key length in bytes (applicable when `mKey` is not NULL). |
| `https://openthread.io/reference/struct/ot-crypto-key#structot_crypto_key_1ad89367195a5433b847052202a1f4968c` | `uint32_t` The PSA key ref (requires `mKey` to be NULL). |

## Public attributes

### mKey

```
const uint8_t * otCryptoKey::mKey
```
Pointer to the buffer containing key. NULL indicates to use `mKeyRef`.

### mKeyLength

```
uint16_t otCryptoKey::mKeyLength
```
The key length in bytes (applicable when `mKey` is not NULL).

### mKeyRef

```
uint32_t otCryptoKey::mKeyRef
```
The PSA key ref (requires `mKey` to be NULL).

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).