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.
Dependencies: nRF51_Vdd TextLCD BME280
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.
If 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.
- Parameters:
-
isalt Input buffer used to create the new key. Same input always generates 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. 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 of 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 Jul 12 2022 15:16:19 by
