Kryptowährung – Plattform
Dieses Modul enthält die Plattformabstraktion für Crypto.
Zusammenfassung
Aufzählungen |
|
---|---|
anonymous enum{
|
enum Diese Aufzählung definiert die wichtigsten Nutzungs-Flags. |
otCryptoKeyAlgorithm{
|
enum Diese Aufzählung definiert die wichtigsten Algorithmen. |
otCryptoKeyStorage{
|
enum Diese Aufzählung definiert die wichtigsten Speichertypen. |
otCryptoKeyType{
|
enum Diese Aufzählung definiert die Schlüsseltypen. |
Typdef. |
|
---|---|
otCryptoContext
|
Typdefstruct otCryptoContext
|
otCryptoKey
|
Typdefstruct otCryptoKey
|
otCryptoKeyRef
|
Typdefuint32_t
Dieser Datentyp stellt die Schlüsselreferenz dar. |
Funktionen |
|
---|---|
otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput)
|
Die angegebenen Daten verschlüsseln.
|
otPlatCryptoAesFree(otCryptoContext *aContext)
|
AES-Kontext freigeben.
|
otPlatCryptoAesInit(otCryptoContext *aContext)
|
AES-Vorgang initialisieren.
|
otPlatCryptoAesSetKey(otCryptoContext *aContext, const otCryptoKey *aKey)
|
Legen Sie den Schlüssel für den AES-Vorgang fest.
|
otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
|
Einen in PSA-ITS gespeicherten Schlüssel löschen
|
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
|
Einen in PSA-ITS gespeicherten Schlüssel exportieren
|
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
|
bool
Prüfen Sie, ob der übergebene Schlüsselverweis in der PSA-ITS mit einem Schlüssel verknüpft ist.
|
otPlatCryptoHkdfDeinit(otCryptoContext *aContext)
|
Deaktivieren Sie den HKDF-Kontext.
|
otPlatCryptoHkdfExpand(otCryptoContext *aContext, const uint8_t *aInfo, uint16_t aInfoLength, uint8_t *aOutputKey, uint16_t aOutputKeyLength)
|
Führe den Schritt „HKDF-Maximieren“ aus.
|
otPlatCryptoHkdfExtract(otCryptoContext *aContext, const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey)
|
Führen Sie den Schritt „HKDF Extract“ aus.
|
otPlatCryptoHkdfInit(otCryptoContext *aContext)
|
HKDF-Kontext initialisieren
|
otPlatCryptoHmacSha256Deinit(otCryptoContext *aContext)
|
Initialisieren Sie den HMAC-Vorgang.
|
otPlatCryptoHmacSha256Finish(otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength)
|
Führen Sie den HMAC-Vorgang aus.
|
otPlatCryptoHmacSha256Init(otCryptoContext *aContext)
|
HMAC-Vorgang initialisieren.
|
otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey *aKey)
|
HMAC-Vorgang starten.
|
otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
Aktualisieren Sie den HMAC-Vorgang mit einer neuen Eingabe.
|
otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen)
|
Einen Schlüssel in PSA-ITS importieren.
|
otPlatCryptoInit(void)
|
void
Initialisieren Sie das Crypto-Modul.
|
otPlatCryptoRandomDeinit(void)
|
void
DeInitialisieren Sie den kryptografisch kryptografisch sicheren Pseudogenerator (CSPRNG).
|
otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize)
|
Füllt einen bestimmten Puffer mit kryptografisch sicheren zufälligen Byte aus.
|
otPlatCryptoRandomInit(void)
|
void
Initialisiert einen kryptografisch sicheren Pseudozahlengenerator (CSPRNG).
|
otPlatCryptoSha256Deinit(otCryptoContext *aContext)
|
Deaktivieren Sie den SHA-256-Vorgang.
|
otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize)
|
SHA-256-Vorgang abschließen.
|
otPlatCryptoSha256Init(otCryptoContext *aContext)
|
SHA-256-Initialisieren.
|
otPlatCryptoSha256Start(otCryptoContext *aContext)
|
SHA-256-Vorgang starten.
|
otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
SHA-256-Vorgang mit neuer Eingabe aktualisieren.
|
Strebenklemmen |
|
---|---|
otCryptoContext |
In dieser Struktur wird das Kontextobjekt für Plattform-APIs gespeichert. |
OTCryptoKey |
Diese Struktur stellt das für Crypto-Vorgänge erforderliche Schlüsselmaterial dar. |
Aufzählungen
Anonyme Aufzählung
anonymous enum
Diese Aufzählung definiert die wichtigsten Nutzungs-Flags.
Attribute | |
---|---|
OT_CRYPTO_KEY_USAGE_DECRYPT
|
Schlüsselverwendung: AES ECB. |
OT_CRYPTO_KEY_USAGE_ENCRYPT
|
Schlüsselverwendung: Verschlüsselung (vom Anbieter definiert). |
OT_CRYPTO_KEY_USAGE_EXPORT
|
Schlüsselverwendung: Der Schlüssel kann exportiert werden. |
OT_CRYPTO_KEY_USAGE_NONE
|
Schlüsselverwendung: Die Schlüsselverwendung ist leer. |
OT_CRYPTO_KEY_USAGE_SIGN_HASH
|
Schlüsselverwendung: HMAC SHA-256. |
OTCryptoKeyAlgorithmus
otCryptoKeyAlgorithm
Diese Aufzählung definiert die wichtigsten Algorithmen.
Attribute | |
---|---|
OT_CRYPTO_KEY_ALG_AES_ECB
|
Schlüsselalgorithmus: AES ECB. |
OT_CRYPTO_KEY_ALG_HMAC_SHA_256
|
Schlüsselalgorithmus: HMAC-SHA-256 |
OT_CRYPTO_KEY_ALG_VENDOR
|
Schlüsselalgorithmus: Anbieterdefiniert. |
otCryptoKeyStorage
otCryptoKeyStorage
Diese Aufzählung definiert die wichtigsten Speichertypen.
Attribute | |
---|---|
OT_CRYPTO_KEY_STORAGE_PERSISTENT
|
Schlüsselpersistenz: Schlüssel ist dauerhaft. |
OT_CRYPTO_KEY_STORAGE_VOLATILE
|
Schlüsselpersistenz: Der Schlüssel ist flüchtig. |
OTCryptoKeyType
otCryptoKeyType
Diese Aufzählung definiert die Schlüsseltypen.
Attribute | |
---|---|
OT_CRYPTO_KEY_TYPE_AES
|
Schlüsseltyp: AES. |
OT_CRYPTO_KEY_TYPE_HMAC
|
Schlüsseltyp: HMAC. |
OT_CRYPTO_KEY_TYPE_RAW
|
Schlüsseltyp: Rohdaten |
Typdef.
otCryptoContext
struct otCryptoContext otCryptoContext
OTCryptoKey
struct otCryptoKey otCryptoKey
OTCryptoKey
uint32_t otCryptoKeyRef
Dieser Datentyp stellt die Schlüsselreferenz dar.
Funktionen
otPlatCryptoAesEncrypt
otError otPlatCryptoAesEncrypt( otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput )
Die angegebenen Daten verschlüsseln.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoAesFree
otError otPlatCryptoAesFree( otCryptoContext *aContext )
AES-Kontext freigeben.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoAesInit
otError otPlatCryptoAesInit( otCryptoContext *aContext )
AES-Vorgang initialisieren.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||
Rückgabewerte |
|
otPlatCryptoAesSetKey
otError otPlatCryptoAesSetKey( otCryptoContext *aContext, const otCryptoKey *aKey )
Legen Sie den Schlüssel für den AES-Vorgang fest.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoDestroySchlüssel
otError otPlatCryptoDestroyKey( otCryptoKeyRef aKeyRef )
Einen in PSA-ITS gespeicherten Schlüssel löschen
Details | |||||
---|---|---|---|---|---|
Parameter |
|
||||
Rückgabewerte |
|
otPlatCryptoExportSchlüssel
otError otPlatCryptoExportKey( otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen )
Einen in PSA-ITS gespeicherten Schlüssel exportieren
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||
Rückgabewerte |
|
otPlatCryptoHasKey
bool otPlatCryptoHasKey( otCryptoKeyRef aKeyRef )
Prüfen Sie, ob der übergebene Schlüsselverweis in der PSA-ITS mit einem Schlüssel verknüpft ist.
Details | |||||
---|---|---|---|---|---|
Parameter |
|
||||
Rückgabewerte |
|
otPlatCryptoHkdfIhrit
otError otPlatCryptoHkdfDeinit( otCryptoContext *aContext )
Deaktivieren Sie den HKDF-Kontext.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHkdfExpand
otError otPlatCryptoHkdfExpand( otCryptoContext *aContext, const uint8_t *aInfo, uint16_t aInfoLength, uint8_t *aOutputKey, uint16_t aOutputKeyLength )
Führe den Schritt „HKDF-Maximieren“ aus.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||||
Rückgabewerte |
|
otPlatCryptoHkdfExtra
otError otPlatCryptoHkdfExtract( otCryptoContext *aContext, const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey )
Führen Sie den Schritt „HKDF Extract“ aus.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||
Rückgabewerte |
|
otPlatCryptoHkdfInit
otError otPlatCryptoHkdfInit( otCryptoContext *aContext )
HKDF-Kontext initialisieren
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHmacSha256Deinit
otError otPlatCryptoHmacSha256Deinit( otCryptoContext *aContext )
Initialisieren Sie den HMAC-Vorgang.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHmacSha256Fertigstellen
otError otPlatCryptoHmacSha256Finish( otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength )
Führen Sie den HMAC-Vorgang aus.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHmacSha256Init
otError otPlatCryptoHmacSha256Init( otCryptoContext *aContext )
HMAC-Vorgang initialisieren.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHmacSha256
otError otPlatCryptoHmacSha256Start( otCryptoContext *aContext, const otCryptoKey *aKey )
HMAC-Vorgang starten.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHmacSha256Update
otError otPlatCryptoHmacSha256Update( otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength )
Aktualisieren Sie den HMAC-Vorgang mit einer neuen Eingabe.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoImportKey
otError otPlatCryptoImportKey( otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen )
Einen Schlüssel in PSA-ITS importieren.
Hinweis:Wenn OT_CRYPTO_KEY_STORAGE_PERSISTENT für „AKeyPersistence“ übergeben wird, muss „aKeyRef
“ eingegeben werden und die Plattform sollte den angegebenen „KeyKey“ verwenden und DARF nicht ändern.
Wenn OT_CRYPTO_KEY_STORAGE_VOLATILE für aKeyPersistence übergeben wird, wird aKeyRef
ausgegeben. Der Anfangswert spielt dabei keine Rolle und die Plattform-API muss sie aktualisieren, um den neuen Schlüsselverweis zu liefern.
Details | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||||||||
Rückgabewerte |
|
Diese API wird nur vom OT Core verwendet, wenn OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
aktiviert ist.
otPlatCryptoInit
void otPlatCryptoInit( void )
Initialisieren Sie das Crypto-Modul.
otPlatCryptoZufallsEigeneit
void otPlatCryptoRandomDeinit( void )
DeInitialisieren Sie den kryptografisch kryptografisch sicheren Pseudogenerator (CSPRNG).
otPlatCryptoZufallsGet
otError otPlatCryptoRandomGet( uint8_t *aBuffer, uint16_t aSize )
Füllt einen bestimmten Puffer mit kryptografisch sicheren zufälligen Byte aus.
Details | |||||
---|---|---|---|---|---|
Parameter |
|
||||
Rückgabewerte |
|
otPlatCryptoZufallsinit
void otPlatCryptoRandomInit( void )
Initialisiert einen kryptografisch sicheren Pseudozahlengenerator (CSPRNG).
otPlatCryptoSha256Deinit
otError otPlatCryptoSha256Deinit( otCryptoContext *aContext )
Deaktivieren Sie den SHA-256-Vorgang.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoSha256Finish
otError otPlatCryptoSha256Finish( otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize )
SHA-256-Vorgang abschließen.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoSha256Init
otError otPlatCryptoSha256Init( otCryptoContext *aContext )
SHA-256-Initialisieren.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoSha256Start
otError otPlatCryptoSha256Start( otCryptoContext *aContext )
SHA-256-Vorgang starten.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoSha256Update
otError otPlatCryptoSha256Update( otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength )
SHA-256-Vorgang mit neuer Eingabe aktualisieren.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
Ressourcen
Die Themen der Referenzthread API basieren auf dem Quellcode, der auf GitHub verfügbar ist. Weitere Informationen sowie die Möglichkeit, in unserer Dokumentation mitzuwirken, finden Sie unter Ressourcen.