nl::Weave::التشفير

تشمل مساحة الاسم هذه جميع الواجهات ضمن Weave للحصول على دعم التشفير المشترك.

الملخّص

تعداد

X963EncodedPointFormat تعداد

رفوف النوع

AES128CTRDRBG typedef
AES128CTRMode typedef
AES256CTRMode typedef
EntropyFunct)(uint8_t *buf, size_t bufSize) typedef
int(*
توقيع دالة تُستخدم لجمع البيانات العشوائية من مصدر إنتروبيا.
HKDFSHA1 typedef
HKDFSHA256 typedef
HMACSHA1 typedef
HMACSHA256 typedef

الدوال

ClearSecretData(uint8_t *buf, uint32_t len)
NL_DLL_EXPORT void
يؤدي إلى محو أول len بايت من مساحة الذاكرة buf
ConstantTimeCompare(const uint8_t *buf1, const uint8_t *buf2, uint16_t len)
bool
يقارِن أول len بايت من مساحة الذاكرة buf1 ومساحة الذاكرة buf2.
DecodeBIGNUMValueLE(BIGNUM & val, uint16_t size, const uint8_t *& p)
DecodeECDSASignature(const EncodedECDSASignature & encodedSig, ECDSA_SIG *& sig)
DecodeECKey(OID curveOID, const EncodedECPrivateKey *encodedPrivKey, const EncodedECPublicKey *encodedPubKey, EC_KEY *& ecKey)
NL_DLL_EXPORT WEAVE_ERROR
DecodeX962ECPoint(const uint8_t *encodedPoint, uint16_t encodedPointLen, EC_GROUP *group, EC_POINT *& point)
NL_DLL_EXPORT WEAVE_ERROR
DecodeX962ECPoint(const uint8_t *encodedPoint, uint16_t encodedPointLen, BIGNUM *& x, BIGNUM *& y)
ECDHComputeSharedSecret(OID curveOID, const EC_GROUP *ecGroup, const EC_POINT *pubKeyPoint, const BIGNUM *privKeyBN, uint8_t *sharedSecretBuf, uint16_t sharedSecretBufSize, uint16_t & sharedSecretLen)
NL_DLL_EXPORT WEAVE_ERROR
ECDHComputeSharedSecret(OID curveOID, const EncodedECPublicKey & encodedPubKey, const EncodedECPrivateKey & encodedPrivKey, uint8_t *sharedSecretBuf, uint16_t sharedSecretBufSize, uint16_t & sharedSecretLen)
ECDSASigToFixedLenSig(OID curveOID, const ECDSA_SIG *ecSig, uint8_t *fixedLenSig)
ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
void
ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
int
EncodeBIGNUMValueLE(const BIGNUM & val, uint16_t size, uint8_t *& p)
EncodeECDSASignature(const ECDSA_SIG *sig, EncodedECDSASignature & encodedSig)
EncodeX962ECPoint(OID curveOID, EC_GROUP *ecGroup, const EC_POINT *point, uint8_t *buf, uint16_t bufSize, uint16_t & encodedPointLen)
NL_DLL_EXPORT WEAVE_ERROR
FixedLenSigToECDSASig(OID curveOID, const uint8_t *fixedLenSig, ECDSA_SIG *& ecSig)
GenerateAndEncodeWeaveHMACSignature(OID sigAlgoOID, TLVWriter & writer, uint64_t tag, const uint8_t *data, uint16_t dataLen, const uint8_t *key, uint16_t keyLen)
إنشاء توقيع WAve HMAC وترميزه.
GenerateAndEncodeWeaveRSASignature(OID sigAlgoOID, TLVWriter & writer, uint64_t tag, const uint8_t *hash, uint8_t hashLen, const uint8_t *keyDER, uint16_t keyDERLen)
إنشاء توقيع Weave RSA وترميزه.
GenerateECDHKey(OID curveOID, EncodedECPublicKey & encodedPubKey, EncodedECPrivateKey & encodedPrivKey)
GenerateECDSASignature(OID curveOID, const uint8_t *msgHash, uint8_t msgHashLen, const EncodedECPrivateKey & encodedPrivKey, EncodedECDSASignature & encodedSig)
GenerateECDSASignature(OID curveOID, const uint8_t *msgHash, uint8_t msgHashLen, const EncodedECPrivateKey & encodedPrivKey, uint8_t *fixedLenSig)
GetCurveG(OID curveOID, EncodedECPublicKey & encodedPubKey)
GetCurveSize(const OID curveOID, const EC_GROUP *ecGroup)
int
GetCurveSize(const OID curveOID)
int
يمكنك الحصول على حجم المنحنى الإهليلجي (بالبايت).
GetECGroupForCurve(OID curveOID, EC_GROUP *& ecGroup)
NL_DLL_EXPORT WEAVE_ERROR
ReverseBytes(uint8_t *buf, size_t len)
void
ShaNIDFromSigAlgoOID(OID sigAlgoOID)
int
VerifyECDSASignature(OID curveOID, const uint8_t *msgHash, uint8_t msgHashLen, const EncodedECDSASignature & encodedSig, const EncodedECPublicKey & encodedPubKey)
VerifyECDSASignature(OID curveOID, const uint8_t *msgHash, uint8_t msgHashLen, const uint8_t *fixedLenSig, const EncodedECPublicKey & encodedPubKey)
VerifyHMACSignature(OID sigAlgoOID, const uint8_t *data, uint16_t dataLen, const EncodedHMACSignature & sig, const uint8_t *key, uint16_t keyLen)
تحقّق من توقيع Weave HMAC.
VerifyRSASignature(OID sigAlgoOID, const uint8_t *hash, uint8_t hashLen, const EncodedRSASignature & sig, const uint8_t *certDER, uint16_t certDERLen)
التحقّق من توقيع RSA Weave.

صفوف

nl::Weave::التشفير::CTRMode
nl::Weave::التشفير::CTR_DRBG
nl::Weave::التشفير::EncodedECDSASignature
nl::Weave::Crypto::EncodedECPrivateKey
nl::Weave::Crypto::EncodedECPublicKey
nl::Weave::التشفير::EncodedHMACSignature
nl::Weave::التشفير::EncodedRSAKey
nl::Weave::التشفير::EncodedRSASignature
nl::Weave::التشفير::HKDF
nl::Weave::التشفير::HKDFSHA1Or256
nl::Weave::التشفير::HMAC

تعداد

تنسيق X963EncodedPointFormat

 X963EncodedPointFormat

رفوف النوع

AES128CTRDRBG

CTR_DRBG< Platform::Security::AES128BlockCipherEnc > AES128CTRDRBG

وضع AES128CTR

CTRMode< Platform::Security::AES128BlockCipherEnc > AES128CTRMode

وضع AES256CTR

CTRMode< Platform::Security::AES256BlockCipherEnc > AES256CTRMode

موسيقى إنتروبيا

int(* EntropyFunct)(uint8_t *buf, size_t bufSize)

توقيع دالة تُستخدم لجمع البيانات العشوائية من مصدر إنتروبيا.

HKDFSHA1

HKDF< Platform::Security::SHA1 > HKDFSHA1

HKDFSHA256

HKDF< Platform::Security::SHA256 > HKDFSHA256

HMACSHA1

HMAC< Platform::Security::SHA1 > HMACSHA1

HMACSHA256

HMAC< Platform::Security::SHA256 > HMACSHA256

الدوال

محو البيانات السرية

NL_DLL_EXPORT void ClearSecretData(
  uint8_t *buf,
  uint32_t len
)

يؤدي إلى محو أول len بايت من مساحة الذاكرة buf

في عملية التنفيذ هذه، يتم ملء أول len بايت من مساحة الذاكرة buf بأصفار.

التفاصيل
المعلَمات
[in] buf
يشير إلى المخزن المؤقت للذاكرة الذي يحتوي على البيانات السرية التي يجب محوها.
[in] len
تحدّد حجم البيانات السرية بالبايت.

مقارنة الوقت الثابت

bool ConstantTimeCompare(
  const uint8_t *buf1,
  const uint8_t *buf2,
  uint16_t len
)

يقارِن أول len بايت من مساحة الذاكرة buf1 ومساحة الذاكرة buf2.

الوقت الذي تتخذه هذه الدالة مستقل عن البيانات في مناطق الذاكرة buf1 وbuf2.

التفاصيل
المعلَمات
[in] buf1
أشِر إلى كتلة الذاكرة.
[in] buf2
أشِر إلى كتلة الذاكرة.
[in] len
حجم مساحة الذاكرة للمقارنة بالبايت.
قيم الإرجاع
true
إذا كانت أول len بايت من مساحة الذاكرة buf1 وbuf2 متساوية
false
وَإِلَّا.

فك الترميزBIGNUMValueLE

WEAVE_ERROR DecodeBIGNUMValueLE(
  BIGNUM & val,
  uint16_t size,
  const uint8_t *& p
)

فك ترميز DSA

WEAVE_ERROR DecodeECDSASignature(
  const EncodedECDSASignature & encodedSig,
  ECDSA_SIG *& sig
)

مفتاح فك التشفير

NL_DLL_EXPORT WEAVE_ERROR DecodeECKey(
  OID curveOID,
  const EncodedECPrivateKey *encodedPrivKey,
  const EncodedECPublicKey *encodedPubKey,
  EC_KEY *& ecKey
)

فك الترميزX962EC

NL_DLL_EXPORT WEAVE_ERROR DecodeX962ECPoint(
  const uint8_t *encodedPoint,
  uint16_t encodedPointLen,
  EC_GROUP *group,
  EC_POINT *& point
)

فك الترميزX962EC

WEAVE_ERROR DecodeX962ECPoint(
  const uint8_t *encodedPoint,
  uint16_t encodedPointLen,
  BIGNUM *& x,
  BIGNUM *& y
)

ECDHComputeSharedSecret

NL_DLL_EXPORT WEAVE_ERROR ECDHComputeSharedSecret(
  OID curveOID,
  const EC_GROUP *ecGroup,
  const EC_POINT *pubKeyPoint,
  const BIGNUM *privKeyBN,
  uint8_t *sharedSecretBuf,
  uint16_t sharedSecretBufSize,
  uint16_t & sharedSecretLen
)

ECDHComputeSharedSecret

WEAVE_ERROR ECDHComputeSharedSecret(
  OID curveOID,
  const EncodedECPublicKey & encodedPubKey,
  const EncodedECPrivateKey & encodedPrivKey,
  uint8_t *sharedSecretBuf,
  uint16_t sharedSecretBufSize,
  uint16_t & sharedSecretLen
)

ECDSASigToFixedLenSig

WEAVE_ERROR ECDSASigToFixedLenSig(
  OID curveOID,
  const ECDSA_SIG *ecSig,
  uint8_t *fixedLenSig
)

ECDSA_SIG_get0

void ECDSA_SIG_get0(
  const ECDSA_SIG *sig,
  const BIGNUM **pr,
  const BIGNUM **ps
)

ECDSA_SIG_set0

int ECDSA_SIG_set0(
  ECDSA_SIG *sig,
  BIGNUM *r,
  BIGNUM *s
)

ترميز BIGNUMValueLE

WEAVE_ERROR EncodeBIGNUMValueLE(
  const BIGNUM & val,
  uint16_t size,
  uint8_t *& p
)

ترميز مؤتمر DSA

WEAVE_ERROR EncodeECDSASignature(
  const ECDSA_SIG *sig,
  EncodedECDSASignature & encodedSig
)

En9X962ECPoint

NL_DLL_EXPORT WEAVE_ERROR EncodeX962ECPoint(
  OID curveOID,
  EC_GROUP *ecGroup,
  const EC_POINT *point,
  uint8_t *buf,
  uint16_t bufSize,
  uint16_t & encodedPointLen
)

ثابتLenSigToECDSASig

WEAVE_ERROR FixedLenSigToECDSASig(
  OID curveOID,
  const uint8_t *fixedLenSig,
  ECDSA_SIG *& ecSig
)

GenerateAndEncodeWeaveHMACSignature

WEAVE_ERROR GenerateAndEncodeWeaveHMACSignature(
  OID sigAlgoOID,
  TLVWriter & writer,
  uint64_t tag,
  const uint8_t *data,
  uint16_t dataLen,
  const uint8_t *key,
  uint16_t keyLen
)

إنشاء توقيع WAve HMAC وترميزه.

لحساب توقيع HMAC لبيانات معيّنة باستخدام مفتاح سري وكتابة التوقيع كبنية توقيع WeAve HMAC إلى كاتب TLV المحدّد مع العلامة المحددة.

التفاصيل
المعلَمات
[in] sigAlgoOID
خوارزمية OID التي سيتم استخدامها لإنشاء توقيع HMAC.
[in] writer
عنصر TLVWriter الذي يجب كتابة التوقيع الموقّع عليه.
[in] tag
علامة TLV المراد ربطها ببنية التوقيع المشفّرة.
[in] data
المخزن المؤقت الذي يتضمن البيانات المراد توقيعها.
[in] dataLen
الطول بالبايت للبيانات.
[in] key
مخزن مؤقت يحتوي على المفتاح السري الذي سيتم استخدامه لإنشاء توقيع HMAC.
[in] keyLen
الطول بالبايت للمفتاح السري.
قيم الإرجاع
WEAVE_NO_ERROR
إذا تم تنفيذ العملية بنجاح.
other
رموز خطأ Weave الأخرى ذات الصلة بترميز التوقيع.

GenerateAndEncodeWeaveRSASignature

WEAVE_ERROR GenerateAndEncodeWeaveRSASignature(
  OID sigAlgoOID,
  TLVWriter & writer,
  uint64_t tag,
  const uint8_t *hash,
  uint8_t hashLen,
  const uint8_t *keyDER,
  uint16_t keyDERLen
)

إنشاء توقيع Weave RSA وترميزه.

لحساب توقيع RSA باستخدام مفتاح خاص بترميز RSA معيّن وتجزئة الرسالة وكتابة التوقيع كبنية SwAve RSASignature إلى كاتب TLV المحدد بالعلامة المعيّنة.

التفاصيل
المعلَمات
[in] sigAlgoOID
الخوارزمية OID التي سيتم استخدامها لإنشاء توقيع RSA.
[in] writer
عنصر TLVWriter الذي يجب كتابة التوقيع الموقّع عليه.
[in] tag
علامة TLV المراد ربطها ببنية التوقيع المشفّرة.
[in] hash
ذاكرة تخزين مؤقت تحتوي على تجزئة البيانات التي سيتم توقيعها.
[in] hashLen
الطول بالبايت لتجزئة البيانات
[in] keyDER
مخزن مؤقت يحتوي على المفتاح الخاص لاستخدامه لإنشاء التوقيع. من المتوقع أن يتم ترميز المفتاح الخاص كبنية مفتاح RSA خاص X509.
[in] keyDERLen
الطول بالبايت للمفتاح الخاص المُشفَّر.
قيم الإرجاع
WEAVE_NO_ERROR
إذا تم تنفيذ العملية بنجاح.
other
رموز خطأ Weave الأخرى المتعلقة بفك ترميز المفتاح الخاص أو إنشاء التوقيع أو ترميزه.

إنشاء مفتاح ECECHH

WEAVE_ERROR GenerateECDHKey(
  OID curveOID,
  EncodedECPublicKey & encodedPubKey,
  EncodedECPrivateKey & encodedPrivKey
)

إنشاء توقيع توقيع ديناميكي على شبكة البحث

WEAVE_ERROR GenerateECDSASignature(
  OID curveOID,
  const uint8_t *msgHash,
  uint8_t msgHashLen,
  const EncodedECPrivateKey & encodedPrivKey,
  EncodedECDSASignature & encodedSig
)

إنشاء توقيع توقيع ديناميكي على شبكة البحث

WEAVE_ERROR GenerateECDSASignature(
  OID curveOID,
  const uint8_t *msgHash,
  uint8_t msgHashLen,
  const EncodedECPrivateKey & encodedPrivKey,
  uint8_t *fixedLenSig
)

GetCurveG

WEAVE_ERROR GetCurveG(
  OID curveOID,
  EncodedECPublicKey & encodedPubKey
)

GetCurveSize

int GetCurveSize(
  const OID curveOID,
  const EC_GROUP *ecGroup
)

GetCurveSize

int GetCurveSize(
  const OID curveOID
)

يمكنك الحصول على حجم المنحنى الإهليلجي (بالبايت).

التفاصيل
المعلَمات
[in] curveOID
معرِّف بيضاوي مُنحني محدد.
قيم الإرجاع
Returns
0 في حال كان المنحنى المنحني المحدَّد غير متوافق. وبخلاف ذلك، يتم عرض حجم المنحنى بالبايت.

GetECGroupForCurve

NL_DLL_EXPORT WEAVE_ERROR GetECGroupForCurve(
  OID curveOID,
  EC_GROUP *& ecGroup
)

عكسية

void ReverseBytes(
  uint8_t *buf,
  size_t len
)

ShaNIDFromSigAlgoOID

int ShaNIDFromSigAlgoOID(
  OID sigAlgoOID
)

إثبات صحة توقيع ECDSA

WEAVE_ERROR VerifyECDSASignature(
  OID curveOID,
  const uint8_t *msgHash,
  uint8_t msgHashLen,
  const EncodedECDSASignature & encodedSig,
  const EncodedECPublicKey & encodedPubKey
)

إثبات صحة توقيع ECDSA

WEAVE_ERROR VerifyECDSASignature(
  OID curveOID,
  const uint8_t *msgHash,
  uint8_t msgHashLen,
  const uint8_t *fixedLenSig,
  const EncodedECPublicKey & encodedPubKey
)

إثبات صحة توقيع MAC

WEAVE_ERROR VerifyHMACSignature(
  OID sigAlgoOID,
  const uint8_t *data,
  uint16_t dataLen,
  const EncodedHMACSignature & sig,
  const uint8_t *key,
  uint16_t keyLen
)

تحقّق من توقيع Weave HMAC.

التحقّق من توقيع HMAC باستخدام بيانات معيّنة ومفتاح سري يمكن استخدامه للتحقّق من التوقيع

التفاصيل
المعلَمات
[in] sigAlgoOID
خوارزمية OID التي سيتم استخدامها لإنشاء توقيع HMAC.
[in] data
المخزن المؤقت الذي يتضمن البيانات المراد توقيعها.
[in] dataLen
الطول بالبايت للبيانات.
[in] sig
توقيع HMAC مُشفّر ليتم التحقّق منه.
[in] key
مخزن مؤقت يحتوي على المفتاح السري الذي سيتم استخدامه لإنشاء توقيع HMAC.
[in] keyLen
الطول بالبايت للمفتاح السري.
قيم الإرجاع
WEAVE_NO_ERROR
في حال نجاح التحقُّق من توقيع HMAC
WEAVE_ERROR_INVALID_SIGNATURE
في حال تعذَّر التحقُّق من صحة توقيع HMAC

إثبات الملكية

WEAVE_ERROR VerifyRSASignature(
  OID sigAlgoOID,
  const uint8_t *hash,
  uint8_t hashLen,
  const EncodedRSASignature & sig,
  const uint8_t *certDER,
  uint16_t certDERLen
)

التحقّق من توقيع RSA Weave.

التحقّق من توقيع RSA باستخدام تجزئة بيانات محددة وشهادة RSA مشفّرة X509 تحتوي على المفتاح العام المطلوب استخدامه للتحقّق من التوقيع.

التفاصيل
المعلَمات
[in] sigAlgoOID
الخوارزمية OID التي سيتم استخدامها لإنشاء توقيع RSA.
[in] hash
ذاكرة تخزين مؤقت تحتوي على تجزئة البيانات التي سيتم توقيعها.
[in] hashLen
الطول بالبايت لتجزئة البيانات
[in] sig
توقيع RSA المشفّر المطلوب التحقّق منه
[in] certDER
مخزن مؤقت يحتوي على الشهادة ذات المفتاح العام المُراد استخدامها للتحقّق من التوقيع. ومن المتوقع أن تكون الشهادة بترميز DER بنية X509 RSA.
[in] certDERLen
الطول بالبايت للشهادة المشفرة.
قيم الإرجاع
WEAVE_NO_ERROR
إذا تم تنفيذ العملية بنجاح.