nl::Weave::Crypto

Bu ad alanı, paylaşılan şifreleme desteği için Weave içindeki tüm arayüzleri içerir.

Özet

Sıralamalar

X963EncodedPointFormat enum

Türdefler

AES128CTRDRBG typedef
AES128CTRMode typedef
AES256CTRMode typedef
EntropyFunct)(uint8_t *buf, size_t bufSize) typedef
int(*
Bir entropi kaynağından rastgele veri toplamak için kullanılan bir işlevin imzası.
HKDFSHA1 typedef
HKDFSHA256 typedef
HMACSHA1 typedef
HMACSHA256 typedef

İşlevler

ClearSecretData(uint8_t *buf, uint32_t len)
NL_DLL_EXPORT void
buf bellek alanının ilk len baytını temizler.
ConstantTimeCompare(const uint8_t *buf1, const uint8_t *buf2, uint16_t len)
bool
buf1 bellek alanı ile buf2 bellek alanının ilk len baytını karşılaştırır.
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)
Bir Weave HMAC imzası oluşturun ve kodlayın.
GenerateAndEncodeWeaveRSASignature(OID sigAlgoOID, TLVWriter & writer, uint64_t tag, const uint8_t *hash, uint8_t hashLen, const uint8_t *keyDER, uint16_t keyDERLen)
Weave RSA imzası oluşturup kodlayın.
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
Elips Biçimli Eğri boyutunu alın (bayt cinsinden).
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 imzasını doğrulayın.
VerifyRSASignature(OID sigAlgoOID, const uint8_t *hash, uint8_t hashLen, const EncodedRSASignature & sig, const uint8_t *certDER, uint16_t certDERLen)
Weave RSA imzasını doğrulayın.

Sınıflar

nl::Weave::Crypto::CTRMode
nl::Weave::Crypto::CTR_DRBG
nl::Weave::Crypto::EncodedECDSASignature
nl::Weave::Crypto::EncodedECPrivateKey
nl::Weave::Crypto::EncodedECPublicKey
nl::Weave::Crypto::EncodedHMACSignature
nl::Weave::Crypto::EncodedRSAKey
nl::Weave::Crypto::EncodedRSASignature
nl::Weave::Crypto::HKDF
nl::Weave::Crypto::HKDFSHA1Or256
nl::Weave::Crypto::HMAC

Sıralamalar

X963EncodedPointFormat

 X963EncodedPointFormat

Türdefler

AES128TODRBG

CTR_DRBG< Platform::Security::AES128BlockCipherEnc > AES128CTRDRBG

AES128TOMode

CTRMode< Platform::Security::AES128BlockCipherEnc > AES128CTRMode

AES256TOMode

CTRMode< Platform::Security::AES256BlockCipherEnc > AES256CTRMode

EntropyFunct

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

Bir entropi kaynağından rastgele veri toplamak için kullanılan bir işlevin imzası.

HKDFSHA1

HKDF< Platform::Security::SHA1 > HKDFSHA1

HKDFSHA256

HKDF< Platform::Security::SHA256 > HKDFSHA256

HMACSHA1

HMAC< Platform::Security::SHA1 > HMACSHA1

HMACSHA256

HMAC< Platform::Security::SHA256 > HMACSHA256

İşlevler

ClearSecretData

NL_DLL_EXPORT void ClearSecretData(
  uint8_t *buf,
  uint32_t len
)

buf bellek alanının ilk len baytını temizler.

Bu uygulamada buf bellek alanının ilk len baytı sıfırlarla doldurulur.

Ayrıntılar
Parametreler
[in] buf
Silinmesi gereken gizli verileri tutan bir bellek arabelleğinin işaretçisi.
[in] len
Gizli anahtar veri boyutunu bayt cinsinden belirtir.

ConstantTimeCompare

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

buf1 bellek alanı ile buf2 bellek alanının ilk len baytını karşılaştırır.

Bu işlev tarafından harcanan süre, buf1 ve buf2 bellek alanlarındaki verilerden bağımsızdır.

Ayrıntılar
Parametreler
[in] buf1
Bellek bloğunun üzerine gelin.
[in] buf2
Bellek bloğunun üzerine gelin.
[in] len
Bayt cinsinden karşılaştırılacak bellek alanının boyutu.
Döndürülen Değerler
true
buf1 ve buf2 bellek alanının ilk len baytı eşitse.
false
Aksi takdirde.

DecodeBIGNUMValueLE

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

DecodeECDSASignature

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

DecodeECKey

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

DecodeX962ECPoint

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

DecodeX962ECPoint

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
)

EncodeBIGNUMValueLE

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

EncodeECDSASignature

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

KodlamaX962ECPoint

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

FixedLenSigToECDSASig

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
)

Bir Weave HMAC imzası oluşturun ve kodlayın.

Gizli anahtarı kullanarak belirli bir veri için HMAC imzası hesaplar ve imzayı, belirtilen etikete sahip belirtilen TLV yazara bir Weave HMACSignature yapısı olarak yazar.

Ayrıntılar
Parametreler
[in] sigAlgoOID
HMAC imzası oluşturmak için kullanılacak algoritma OID.
[in] writer
Kodlanmış imzanın yazılması gereken TLVWriter nesnesi.
[in] tag
Kodlanmış imza yapısıyla ilişkilendirilecek TLV etiketinin alt etiketidir.
[in] data
İmzalanacak verileri içeren bir tampon.
[in] dataLen
Verilerin bayt cinsinden uzunluğu.
[in] key
HMAC imzası oluşturmak için kullanılacak gizli anahtarı içeren bir arabellek.
[in] keyLen
Gizli anahtarın bayt cinsinden uzunluğu.
Döndürülen Değerler
WEAVE_NO_ERROR
İşlem başarılı olup olmadığı.
other
İmza kodlamasıyla ilgili diğer Weave hata kodları.

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 imzası oluşturup kodlayın.

Belirli bir X509 kodlanmış RSA özel anahtarını ve mesaj karmasını kullanarak bir RSA imzası hesaplar ve bu imzayı, belirtilen etikete sahip belirtilen TLV yazarına bir Weave RSASignature yapısı olarak yazar.

Ayrıntılar
Parametreler
[in] sigAlgoOID
RSA imzası oluşturmak için kullanılacak algoritma OID.
[in] writer
Kodlanmış imzanın yazılması gereken TLVWriter nesnesi.
[in] tag
Kodlanmış imza yapısıyla ilişkilendirilecek TLV etiketinin alt etiketidir.
[in] hash
İmzalanacak verilerin karmasını içeren bir tampon.
[in] hashLen
Veri karmasının bayt cinsinden uzunluğu.
[in] keyDER
İmzayı oluşturmak için kullanılacak özel anahtarı içeren bir arabellek. Özel anahtarın X509 RSA özel anahtar yapısı olarak kodlanması beklenir.
[in] keyDERLen
Kodlanmış özel anahtarın bayt cinsinden uzunluğu.
Döndürülen Değerler
WEAVE_NO_ERROR
İşlem başarılı olup olmadığı.
other
Özel anahtarın kodunu çözme, imza oluşturma veya imzayı kodlamayla ilgili diğer Weave hata kodları.

GenerateECDHKey

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

GenerateECDSASignature

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

GenerateECDSASignature

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
)

Elips Biçimli Eğri boyutunu alın (bayt cinsinden).

Ayrıntılar
Parametreler
[in] curveOID
Belirtilen Elips Biçimli Eğri OID.
Döndürülen Değerler
Returns
Belirtilen eğri OID desteklenmiyorsa Elips Biçimli Eğri ise 0 değerini alır. Aksi takdirde, eğri boyutunu bayt cinsinden döndürür.

GetECGroupForCurve

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

ReverseBytes

void ReverseBytes(
  uint8_t *buf,
  size_t len
)

ShaNIDFromSigAlgoOID

int ShaNIDFromSigAlgoOID(
  OID sigAlgoOID
)

VerifyECDSASignature

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

VerifyECDSASignature

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

VerifyHMACSignature

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

Weave HMAC imzasını doğrulayın.

Verilen verileri ve imzayı doğrulamak için kullanılacak gizli anahtarı kullanarak HMAC imzasını doğrular.

Ayrıntılar
Parametreler
[in] sigAlgoOID
HMAC imzası oluşturmak için kullanılacak algoritma OID.
[in] data
İmzalanacak verileri içeren bir tampon.
[in] dataLen
Verilerin bayt cinsinden uzunluğu.
[in] sig
Doğrulanacak kodlu HMAC imzası.
[in] key
HMAC imzası oluşturmak için kullanılacak gizli anahtarı içeren bir arabellek.
[in] keyLen
Gizli anahtarın bayt cinsinden uzunluğu.
Döndürülen Değerler
WEAVE_NO_ERROR
HMAC imzası doğrulaması başarılı olup olmadığı.
WEAVE_ERROR_INVALID_SIGNATURE
HMAC imzası doğrulaması başarısız olduysa.

VerifyRSASignature

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

Weave RSA imzasını doğrulayın.

Verilen veri karmasını ve imzayı doğrulamak için kullanılacak ortak anahtarı içeren X509 olarak kodlanmış RSA sertifikasını kullanarak bir RSA imzasını doğrular.

Ayrıntılar
Parametreler
[in] sigAlgoOID
RSA imzası oluşturmak için kullanılacak algoritma OID.
[in] hash
İmzalanacak verilerin karmasını içeren bir tampon.
[in] hashLen
Veri karmasının bayt cinsinden uzunluğu.
[in] sig
Doğrulanacak kodlanmış RSA imzası.
[in] certDER
İmzayı doğrulamak için kullanılacak ortak anahtara sahip sertifikayı içeren bir arabellek. Sertifikanın DER kodlamalı bir X509 RSA yapısı olması beklenir.
[in] certDERLen
Kodlanmış sertifikanın bayt cinsinden uzunluğu.
Döndürülen Değerler
WEAVE_NO_ERROR
İşlem başarılı olup olmadığı.