الترميز - النظام الأساسي
تتضمّن هذه الوحدة تجريب النظام الأساسي للتشفير.
الملخّص
التعدادات |
|
---|---|
anonymous enum{
|
تعداد تحدّد هذه القائمة العدد علامات استخدام المفاتيح. |
otCryptoKeyAlgorithm{
|
تعداد وتحدّد هذه القائمة العددية الخوارزميات الأساسية. |
otCryptoKeyStorage{
|
تعداد ويحدّد هذا العدد أنواع مساحة التخزين الرئيسية. |
otCryptoKeyType{
|
تعداد تحدّد هذه القائمة العدد أنواع المفاتيح. |
مواقد الخط |
|
---|---|
otCryptoContext
|
مَعلمة typetypestruct otCryptoContext
|
otCryptoKey
|
مَعلمة typetypestruct otCryptoKey
|
otCryptoKeyRef
|
مَعلمة typetypeuint32_t
ويمثل نوع البيانات هذا المرجع الرئيسي. |
الدوال |
|
---|---|
otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput)
|
تشفير البيانات المحددة.
|
otPlatCryptoAesFree(otCryptoContext *aContext)
|
وفِّر سياق AES.
|
otPlatCryptoAesInit(otCryptoContext *aContext)
|
ابدأ عملية AES.
|
otPlatCryptoAesSetKey(otCryptoContext *aContext, const otCryptoKey *aKey)
|
ضبط مفتاح عملية AES
|
otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
|
محو مفتاح محفوظ في PSA ITS
|
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
|
تصدير مفتاح محفوظ في PSA ITS.
|
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
|
bool
تحقق مما إذا كان المفتاح الذي تم تمريره يتضمن مفتاحًا مرتبطًا في PSA ITS.
|
otPlatCryptoHkdfDeinit(otCryptoContext *aContext)
|
إعداد سياق HKDF.
|
otPlatCryptoHkdfExpand(otCryptoContext *aContext, const uint8_t *aInfo, uint16_t aInfoLength, uint8_t *aOutputKey, uint16_t aOutputKeyLength)
|
تنفيذ خطوة توسيع HKDF.
|
otPlatCryptoHkdfExtract(otCryptoContext *aContext, const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey)
|
تنفيذ خطوة استخراج HKDF.
|
otPlatCryptoHkdfInit(otCryptoContext *aContext)
|
إعداد سياق HKDF.
|
otPlatCryptoHmacSha256Deinit(otCryptoContext *aContext)
|
إعداد عملية HMAC.
|
otPlatCryptoHmacSha256Finish(otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength)
|
أكمِل عملية HMAC.
|
otPlatCryptoHmacSha256Init(otCryptoContext *aContext)
|
ابدأ عملية HMAC.
|
otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey *aKey)
|
بدء عملية HMAC.
|
otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
تحديث عملية HMAC بالإدخال الجديد.
|
otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen)
|
احرِص على استيراد مفتاح إلى PSA ITS.
|
otPlatCryptoInit(void)
|
void
إعداد وحدة التشفير.
|
otPlatCryptoRandomDeinit(void)
|
void
إعداد أداة إعداد الأرقام الصورية المشفَّرة بأمان (CSPRNG).
|
otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize)
|
يملأ ذاكرة تخزين مؤقت معيّنة بوحدات بايت عشوائية مشفّرة مشفّرة.
|
otPlatCryptoRandomInit(void)
|
void
إعداد أداة إنشاء الأرقام المضلِّلة المشفَّرة (CSPRNG) بشكل آمن
|
otPlatCryptoSha256Deinit(otCryptoContext *aContext)
|
تهيئة عملية SHA-256.
|
otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize)
|
إتمام عملية SHA-256
|
otPlatCryptoSha256Init(otCryptoContext *aContext)
|
تهيئة عملية SHA-256.
|
otPlatCryptoSha256Start(otCryptoContext *aContext)
|
ابدأ عملية SHA-256.
|
otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength)
|
عدِّل عملية SHA-256 بإدخال جديد.
|
التشريعات |
|
---|---|
otCryptoContext |
تخزِّن هذه البنية كائن السياق لواجهات برمجة تطبيقات النظام الأساسي. |
otCryptoKey |
وتمثل هذه البنية المادة الأساسية المطلوبة لتشغيل عمليات التشفير. |
التعدادات
عدد مجهول
anonymous enum
تحدّد هذه القائمة العدد علامات استخدام المفاتيح.
المنشآت الفندقية | |
---|---|
OT_CRYPTO_KEY_USAGE_DECRYPT
|
استخدام المفتاح: AES ECB. |
OT_CRYPTO_KEY_USAGE_ENCRYPT
|
استخدام المفتاح: التشفير (مُحدّد للمورّد) |
OT_CRYPTO_KEY_USAGE_EXPORT
|
استخدام المفتاح: يمكن تصدير المفتاح. |
OT_CRYPTO_KEY_USAGE_NONE
|
استخدام المفتاح: استخدام المفتاح فارغ. |
OT_CRYPTO_KEY_USAGE_SIGN_HASH
|
استخدام المفتاح: HMAC SHA-256. |
otCryptoKeyAlgoritham
otCryptoKeyAlgorithm
وتحدّد هذه القائمة العددية الخوارزميات الأساسية.
المنشآت الفندقية | |
---|---|
OT_CRYPTO_KEY_ALG_AES_ECB
|
خوارزمية المفتاح: AES ECB. |
OT_CRYPTO_KEY_ALG_HMAC_SHA_256
|
خوارزمية المفتاح: HMAC SHA-256. |
OT_CRYPTO_KEY_ALG_VENDOR
|
خوارزمية المفتاح: تم تحديد المورد. |
otCryptoKeyStorage
otCryptoKeyStorage
ويحدّد هذا العدد أنواع مساحة التخزين الرئيسية.
المنشآت الفندقية | |
---|---|
OT_CRYPTO_KEY_STORAGE_PERSISTENT
|
الاستمرارية الرئيسية: المفتاح ثابت. |
OT_CRYPTO_KEY_STORAGE_VOLATILE
|
الاستمرارية الرئيسية: المفتاح متقلب. |
otCryptoKeyType
otCryptoKeyType
تحدّد هذه القائمة العدد أنواع المفاتيح.
المنشآت الفندقية | |
---|---|
OT_CRYPTO_KEY_TYPE_AES
|
نوع المفتاح: AES. |
OT_CRYPTO_KEY_TYPE_HMAC
|
نوع المفتاح: HMAC. |
OT_CRYPTO_KEY_TYPE_RAW
|
النوع الأساسي: بيانات أولية. |
مواقد الخط
otCryptoContext
struct otCryptoContext otCryptoContext
مفتاح otCryptoKey
struct otCryptoKey otCryptoKey
otCryptoKeyRef
uint32_t otCryptoKeyRef
ويمثل نوع البيانات هذا المرجع الرئيسي.
الدوال
otPlatCryptoAesEncrypt
otError otPlatCryptoAesEncrypt( otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput )
تشفير البيانات المحددة.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoAesFree
otError otPlatCryptoAesFree( otCryptoContext *aContext )
وفِّر سياق AES.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoAesInit
otError otPlatCryptoAesInit( otCryptoContext *aContext )
ابدأ عملية AES.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otPlatCryptoAesSetKey
otError otPlatCryptoAesSetKey( otCryptoContext *aContext, const otCryptoKey *aKey )
ضبط مفتاح عملية AES
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
مفتاح otPlatCryptoDestroy
otError otPlatCryptoDestroyKey( otCryptoKeyRef aKeyRef )
محو مفتاح محفوظ في PSA ITS
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
قيم الإرجاع |
|
otPlatCryptoExportKey
otError otPlatCryptoExportKey( otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen )
تصدير مفتاح محفوظ في PSA ITS.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otPlatCryptoHasKey
bool otPlatCryptoHasKey( otCryptoKeyRef aKeyRef )
تحقق مما إذا كان المفتاح الذي تم تمريره يتضمن مفتاحًا مرتبطًا في PSA ITS.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
قيم الإرجاع |
|
otPlatCryptoHkdfDeinit
otError otPlatCryptoHkdfDeinit( otCryptoContext *aContext )
إعداد سياق HKDF.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoHkdfتوسيع
otError otPlatCryptoHkdfExpand( otCryptoContext *aContext, const uint8_t *aInfo, uint16_t aInfoLength, uint8_t *aOutputKey, uint16_t aOutputKeyLength )
تنفيذ خطوة توسيع HKDF.
التفاصيل | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||
قيم الإرجاع |
|
otPlatCryptoHkdfاستخراج
otError otPlatCryptoHkdfExtract( otCryptoContext *aContext, const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey )
تنفيذ خطوة استخراج HKDF.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otPlatCryptoHkdfInit
otError otPlatCryptoHkdfInit( otCryptoContext *aContext )
إعداد سياق HKDF.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoHmacSha256Deinit
otError otPlatCryptoHmacSha256Deinit( otCryptoContext *aContext )
إعداد عملية HMAC.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoHmacSHa256إنهاء
otError otPlatCryptoHmacSha256Finish( otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength )
أكمِل عملية HMAC.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoHmacSha256Init
otError otPlatCryptoHmacSha256Init( otCryptoContext *aContext )
ابدأ عملية HMAC.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoHmacSha256Start
otError otPlatCryptoHmacSha256Start( otCryptoContext *aContext, const otCryptoKey *aKey )
بدء عملية HMAC.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoHmacSHa256تحديث
otError otPlatCryptoHmacSha256Update( otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength )
تحديث عملية HMAC بالإدخال الجديد.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoImportKey
otError otPlatCryptoImportKey( otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen )
احرِص على استيراد مفتاح إلى PSA ITS.
ملاحظة: إذا تم تمرير OT_CRYPTO_KEY_STORAGE_PERSISTENT لـ KeyKeysistence، يجب أن يكون aKeyRef
هو الإدخال والنظام الأساسي يجب أن يستخدم KeyKey المحدد ولا يجب أن يغيّره.
إذا تم تمرير OT_CRYPTO_KEY_STORAGE_VOLATILE لـ KeyPersistence ثم aKeyRef
، تكون القيمة الأولى غير مهمة ويجب على واجهة برمجة تطبيقات النظام الأساسي تحديثه لعرض مرجع المفتاح الجديد.
التفاصيل | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||||||
قيم الإرجاع |
|
لا يتم استخدام واجهة برمجة التطبيقات هذه إلا من خلال OT Core عندما يتم تفعيل OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
.
otPlatCryptoInit
void otPlatCryptoInit( void )
إعداد وحدة التشفير.
otPlatCryptoHiddenDeinit
void otPlatCryptoRandomDeinit( void )
إعداد أداة إعداد الأرقام الصورية المشفَّرة بأمان (CSPRNG).
otPlatCryptoHiddenGet
otError otPlatCryptoRandomGet( uint8_t *aBuffer, uint16_t aSize )
يملأ ذاكرة تخزين مؤقت معيّنة بوحدات بايت عشوائية مشفّرة مشفّرة.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
قيم الإرجاع |
|
otPlatCryptoHiddenInit
void otPlatCryptoRandomInit( void )
إعداد أداة إنشاء الأرقام المضلِّلة المشفَّرة (CSPRNG) بشكل آمن
otPlatCryptoSha256Deinit
otError otPlatCryptoSha256Deinit( otCryptoContext *aContext )
تهيئة عملية SHA-256.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoSHa256إنهاء
otError otPlatCryptoSha256Finish( otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize )
إتمام عملية SHA-256
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoSha256Init
otError otPlatCryptoSha256Init( otCryptoContext *aContext )
تهيئة عملية SHA-256.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoSha256Start
otError otPlatCryptoSha256Start( otCryptoContext *aContext )
ابدأ عملية SHA-256.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otPlatCryptoSha256تحديث
otError otPlatCryptoSha256Update( otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength )
عدِّل عملية SHA-256 بإدخال جديد.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
المراجع
تنشأ مواضيع واجهة برمجة التطبيقات المرجعية لـ OpenThread من رمز المصدر، المتوفر على GitHub. للاطّلاع على مزيد من المعلومات أو للمساهمة في مستنداتنا، يُرجى الرجوع إلى المراجع.