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. |
Typdefs |
|
---|---|
otCryptoContext
|
Typdefstruct otCryptoContext
|
otCryptoKey
|
Typdefstruct otCryptoKey
|
otCryptoKeyRef
|
Typdefuint32_t
Dieser Datentyp stellt die Schlüsselreferenz dar. |
otPlatCryptoEcdsaKeyPair
|
Typdefstruct otPlatCryptoEcdsaKeyPair
|
otPlatCryptoEcdsaPublicKey
|
Typdefstruct otPlatCryptoEcdsaPublicKey
|
otPlatCryptoEcdsaSignature
|
Typdefstruct otPlatCryptoEcdsaSignature
|
otPlatCryptoSha256Hash
|
Typdefstruct otPlatCryptoSha256Hash
Diese Struktur stellt einen SHA-256-Hash dar. |
Variablen |
|
---|---|
OT_TOOL_PACKED_END
|
Funktionen |
|
---|---|
otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput)
|
Verschlüsseln Sie die angegebenen Daten.
|
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)
|
Löschen Sie einen in PSA ITS gespeicherten Schlüssel.
|
otPlatCryptoEcdsaGenerateKey(otPlatCryptoEcdsaKeyPair *aKeyPair)
|
Generieren Sie den Ausgabepuffer und füllen Sie ihn mit einem neuen ECDSA-Schlüsselpaar.
|
otPlatCryptoEcdsaGetPublicKey(const otPlatCryptoEcdsaKeyPair *aKeyPair, otPlatCryptoEcdsaPublicKey *aPublicKey)
|
Ruft den zugehörigen öffentlichen Schlüssel aus dem Eingabekontext ab.
|
otPlatCryptoEcdsaSign(const otPlatCryptoEcdsaKeyPair *aKeyPair, const otPlatCryptoSha256Hash *aHash, otPlatCryptoEcdsaSignature *aSignature)
|
Berechnet die ECDSA-Signatur für eine Hash-Nachricht mit dem privaten Schlüssel aus dem Eingabekontext.
|
otPlatCryptoEcdsaVerify(const otPlatCryptoEcdsaPublicKey *aPublicKey, const otPlatCryptoSha256Hash *aHash, const otPlatCryptoEcdsaSignature *aSignature)
|
Verwenden Sie den Schlüssel aus dem Eingabekontext, um die ECDSA-Signatur einer gehashten Nachricht zu prüfen.
|
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
|
Exportieren Sie einen in PSA ITS gespeicherten Schlüssel.
|
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
|
bool
Prüfen Sie, ob die übergebene Schlüsselreferenz in der PSA-ITS verknüpft ist.
|
otPlatCryptoHkdfDeinit(otCryptoContext *aContext)
|
Initialisieren Sie den HKDF-Kontext.
|
otPlatCryptoHkdfExpand(otCryptoContext *aContext, const uint8_t *aInfo, uint16_t aInfoLength, uint8_t *aOutputKey, uint16_t aOutputKeyLength)
|
Führen Sie den Schritt „HKDF-Maximierung“ 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)
|
Schließen Sie den HMAC-Vorgang ab.
|
otPlatCryptoHmacSha256Init(otCryptoContext *aContext)
|
Initialisieren Sie den HMAC-Vorgang.
|
otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey *aKey)
|
HMAC-Vorgang starten.
|
otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
HMAC-Vorgang mit neuer Eingabe aktualisieren.
|
otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen)
|
Importieren Sie einen Schlüssel in PSA ITS.
|
otPlatCryptoInit(void)
|
void
Initialisieren Sie das Crypto-Modul.
|
otPlatCryptoPbkdf2GenerateKey(const uint8_t *aPassword, uint16_t aPasswordLen, const uint8_t *aSalt, uint16_t aSaltLen, uint32_t aIterationCounter, uint16_t aKeyLen, uint8_t *aKey)
|
void
Führen Sie PKCS#5 PBKDF2 mit CMAC (AES-CMAC-PRF-128) aus.
|
otPlatCryptoRandomDeinit(void)
|
void
Deinitialisieren Sie kryptografisch verschlüsselte Pseudozufallszahlen (CSPRNG).
|
otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize)
|
Füllt einen bestimmten Puffer mit kryptografisch sicheren zufälligen Byte aus.
|
otPlatCryptoRandomInit(void)
|
void
Einen kryptografisch sicheren Pseudozufallszahlengenerator (CSPRNG) initialisieren.
|
otPlatCryptoSha256Deinit(otCryptoContext *aContext)
|
Initialisieren Sie den SHA-256-Vorgang.
|
otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize)
|
SHA-256-Vorgang abschließen.
|
otPlatCryptoSha256Init(otCryptoContext *aContext)
|
SHA-256-Vorgang initialisieren
|
otPlatCryptoSha256Start(otCryptoContext *aContext)
|
SHA-256-Vorgang starten.
|
otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
SHA-256-Vorgang mit neuer Eingabe aktualisieren.
|
Structs |
|
---|---|
otCryptoContext |
In dieser Struktur wird das Kontextobjekt für Plattform-APIs gespeichert. |
otCryptoKey |
Diese Struktur stellt das für kryptografische Vorgänge erforderliche Schlüsselmaterial dar. |
otPlatCryptoEcdsaKeyPair |
Diese Struktur stellt ein ECDSA-Schlüsselpaar dar (öffentliche und private Schlüssel). |
otPlatCryptoEcdsaPublicKey |
Diese Struktur stellt einen öffentlichen ECDSA-Schlüssel dar. |
otPlatCryptoEcdsaSignature |
Diese Struktur stellt eine ECDSA-Signatur dar. |
otPlatCryptoSha256Hash |
Diese Struktur stellt einen SHA-256-Hash 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: 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. |
OTCryptoKey-Algorithmus
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: Anbieter definiert. |
otCryptoKeySpeicher
otCryptoKeyStorage
Diese Aufzählung definiert die wichtigsten Speichertypen.
Attribute | |
---|---|
OT_CRYPTO_KEY_STORAGE_PERSISTENT
|
Schlüsselpersistenz: Schlüssel ist persistent. |
OT_CRYPTO_KEY_STORAGE_VOLATILE
|
Schlüsselpersistenz: Schlüssel ist flüchtig. |
Typ „otCryptoKey“
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. |
Typdefs
otCryptoContext
struct otCryptoContext otCryptoContext
OTCryptoKey
struct otCryptoKey otCryptoKey
OtCryptoKeyRef
uint32_t otCryptoKeyRef
Dieser Datentyp stellt die Schlüsselreferenz dar.
otPlatCryptoEcdsaSchlüsselpaar
struct otPlatCryptoEcdsaKeyPair otPlatCryptoEcdsaKeyPair
otPlatCryptoEcdsaPublicKey
struct otPlatCryptoEcdsaPublicKey otPlatCryptoEcdsaPublicKey
otPlatCryptoEcdsa-Signatur
struct otPlatCryptoEcdsaSignature otPlatCryptoEcdsaSignature
otPlatCryptoSha256Hash
struct otPlatCryptoSha256Hash otPlatCryptoSha256Hash
Diese Struktur stellt einen SHA-256-Hash dar.
Variablen
OT_TOOL_PACKED_END
OT_TOOL_PACKED_BEGIN struct otPlatCryptoSha256Hash OT_TOOL_PACKED_END
Funktionen
otPlatCryptoAesEncrypt
otError otPlatCryptoAesEncrypt( otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput )
Verschlüsseln Sie die angegebenen Daten.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoAesKostenlos
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 )
Löschen Sie einen in PSA ITS gespeicherten Schlüssel.
Details | |||||
---|---|---|---|---|---|
Parameter |
|
||||
Rückgabewerte |
|
otPlatCryptoEcdsaGenerateKey (in englischer Sprache)
otError otPlatCryptoEcdsaGenerateKey( otPlatCryptoEcdsaKeyPair *aKeyPair )
Generieren Sie den Ausgabepuffer und füllen Sie ihn mit einem neuen ECDSA-Schlüsselpaar.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||
Rückgabewerte |
|
otPlatCryptoEcdsaGetPublicKey
otError otPlatCryptoEcdsaGetPublicKey( const otPlatCryptoEcdsaKeyPair *aKeyPair, otPlatCryptoEcdsaPublicKey *aPublicKey )
Ruft den zugehörigen öffentlichen Schlüssel aus dem Eingabekontext ab.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoEcdsaSign
otError otPlatCryptoEcdsaSign( const otPlatCryptoEcdsaKeyPair *aKeyPair, const otPlatCryptoSha256Hash *aHash, otPlatCryptoEcdsaSignature *aSignature )
Berechnet die ECDSA-Signatur für eine Hash-Nachricht mit dem privaten Schlüssel aus dem Eingabekontext.
Diese Methode verwendet das deterministische Verfahren zur Generierung digitaler Signaturen aus RFC 6979.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||
Rückgabewerte |
|
otPlatCryptoEcdsaBestätigen
otError otPlatCryptoEcdsaVerify( const otPlatCryptoEcdsaPublicKey *aPublicKey, const otPlatCryptoSha256Hash *aHash, const otPlatCryptoEcdsaSignature *aSignature )
Verwenden Sie den Schlüssel aus dem Eingabekontext, um die ECDSA-Signatur einer gehashten Nachricht zu prüfen.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||
Rückgabewerte |
|
otPlatCryptoExportKey
otError otPlatCryptoExportKey( otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen )
Exportieren Sie einen in PSA ITS gespeicherten Schlüssel.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||
Rückgabewerte |
|
otPlatCryptoHasKey
bool otPlatCryptoHasKey( otCryptoKeyRef aKeyRef )
Prüfen Sie, ob die übergebene Schlüsselreferenz in der PSA-ITS verknüpft ist.
Details | |||||
---|---|---|---|---|---|
Parameter |
|
||||
Rückgabewerte |
|
otPlatCryptoHkdf – Deinit
otError otPlatCryptoHkdfDeinit( otCryptoContext *aContext )
Initialisieren 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ühren Sie den Schritt „HKDF-Maximierung“ aus.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameter |
|
||||||||||
Rückgabewerte |
|
otPlatCryptoHkdfExtract
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 |
|
Ende der otPlatCryptoHmacSha256-Ausführung
otError otPlatCryptoHmacSha256Finish( otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength )
Schließen Sie den HMAC-Vorgang ab.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHmacSha256Init
otError otPlatCryptoHmacSha256Init( otCryptoContext *aContext )
Initialisieren Sie den HMAC-Vorgang.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoHmacSha256Start
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 )
HMAC-Vorgang mit neuer Eingabe aktualisieren.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
otPlatCryptoImportKey
otError otPlatCryptoImportKey( otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen )
Importieren Sie einen Schlüssel in PSA ITS.
Hinweis: Wenn OT_CRYPTO_KEY_STORAGE_PERSISTENT für aKeyPersistence übergeben wird, ist aKeyRef
eine Eingabe und die Plattform sollte die angegebene aKeyRef verwenden und darf sie nicht ändern.
Wenn OT_CRYPTO_KEY_STORAGE_VOLATILE für aKeyPersistence übergeben wird, dann wird aKeyRef
ausgegeben. Der Anfangswert ist unerheblich und die Plattform-API MUSS ihn aktualisieren, um den neuen Schlüsselverweis zurückzugeben.
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.
otPlatCryptoPbkdf2GenerateKey (in englischer Sprache)
void otPlatCryptoPbkdf2GenerateKey( const uint8_t *aPassword, uint16_t aPasswordLen, const uint8_t *aSalt, uint16_t aSaltLen, uint32_t aIterationCounter, uint16_t aKeyLen, uint8_t *aKey )
Führen Sie PKCS#5 PBKDF2 mit CMAC (AES-CMAC-PRF-128) aus.
Details | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameter |
|
otPlatCryptoRandomIhrit
void otPlatCryptoRandomDeinit( void )
Deinitialisieren Sie kryptografisch verschlüsselte Pseudozufallszahlen (CSPRNG).
otPlatCryptoRandomGets
otError otPlatCryptoRandomGet( uint8_t *aBuffer, uint16_t aSize )
Füllt einen bestimmten Puffer mit kryptografisch sicheren zufälligen Byte aus.
Details | |||||
---|---|---|---|---|---|
Parameter |
|
||||
Rückgabewerte |
|
otPlatCryptoRandomInit
void otPlatCryptoRandomInit( void )
Einen kryptografisch sicheren Pseudozufallszahlengenerator (CSPRNG) initialisieren.
otPlatCryptoSha256Deinit
otError otPlatCryptoSha256Deinit( otCryptoContext *aContext )
Initialisieren Sie den SHA-256-Vorgang.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameter |
|
||||||
Rückgabewerte |
|
Ende der otPlatCryptoSha256-Ausführung
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-Vorgang 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 |
|
Makros
OT_CRYPTO_ECDSA_MAX_DER_SIZE
OT_CRYPTO_ECDSA_MAX_DER_SIZE 125
Maximale Puffergröße in Byte für das EDCSA-Schlüsselpaar im DER-Format.
OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE
OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE 64
Puffergröße (in Byte) für den öffentlichen EDCSA-Schlüssel.
OT_CRYPTO_ECDSA_SIGNATURE_SIZE
OT_CRYPTO_ECDSA_SIGNATURE_SIZE 64
Puffergröße in Byte für die Darstellung der EDCSA-Signatur.
OT_CRYPTO_PBDKF2_MAX_SALT_SIZE
OT_CRYPTO_PBDKF2_MAX_SALT_SIZE 30
Max. PBKDF2-SALT-Länge: Salzpräfix (6) + erweiterter Panid (8) + Netzwerkname (16)
OT_CRYPTO_SHA256_HASH_SIZE
OT_CRYPTO_SHA256_HASH_SIZE 32
Länge von SHA256-Hash (in Byte).
Ressourcen
Die OpenThread API-Referenzthemen stammen aus dem Quellcode, der auf GitHub verfügbar ist. Weitere Informationen sowie Informationen zu unserer Dokumentation finden Sie unter Ressourcen.