Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DeviceKey Class Reference
[Drivers]
Use this singleton if you need to derive a new key from the device root of trust. More...
#include <DeviceKey.h>
Inherits NonCopyable< DeviceKey >.
Public Member Functions | |
int | generate_derived_key (const unsigned char *isalt, size_t isalt_size, unsigned char *output, uint16_t ikey_type) |
Derive a new key based on the salt string. | |
int | device_inject_root_of_trust (uint32_t *value, size_t isize) |
Set a device key into the NVStore. | |
Static Public Member Functions | |
static DeviceKey & | get_instance () |
As a singleton, return the single instance of the class. | |
Private Member Functions | |
MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &) | |
NonCopyable copy constructor. | |
MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator | |
NonCopyable copy assignment operator. |
Detailed Description
Use this singleton if you need to derive a new key from the device root of trust.
- Note:
- Synchronization level: Thread safe
Definition at line 53 of file DeviceKey.h.
Member Function Documentation
int device_inject_root_of_trust | ( | uint32_t * | value, |
size_t | isize | ||
) |
Set a device key into the NVStore.
In case TRNG support is missing, Call this method before calling device_key_derived_key. This method should be called only once!
- Parameters:
-
value input buffer contain the key. isize size of the supplied key. Must be 16 bytes or 32 bytes.
- Returns:
- 0 on success, negative error code on failure
Definition at line 98 of file DeviceKey.cpp.
int generate_derived_key | ( | const unsigned char * | isalt, |
size_t | isalt_size, | ||
unsigned char * | output, | ||
uint16_t | ikey_type | ||
) |
Derive a new key based on the salt string.
key type can be with values 16 bytes and 32 bytes
- Parameters:
-
isalt input buffer used to create the new key. Same input will generate always the same key isalt_size size of the data in salt buffer output buffer to receive the derived key. Size must be 16 bytes or 32 bytes according to the ikey_type parameter ikey_type type of the required key. Type must be 16 bytes or 32 bytes.
- Returns:
- 0 on success, negative error code on failure
Definition at line 61 of file DeviceKey.cpp.
static DeviceKey& get_instance | ( | ) | [static] |
As a singleton, return the single instance of the class.
Reason for this class being a singleton is the following:
- Ease the use for users of this class not having to coordinate instantiations.
- Lazy instantiation of internal data (which we can't achieve with simple static classes).
- Returns:
- Singleton instance reference.
Definition at line 64 of file DeviceKey.h.
Generated on Tue Aug 9 2022 00:37:38 by
