nl:: Weave:: Crypto
此命名空间包含 Weave 中的所有接口,用于支持共享加密。
摘要
枚举 |
|
---|---|
X963EncodedPointFormat
|
枚举 |
类型定义符 |
|
---|---|
AES128CTRDRBG
|
typedef |
AES128CTRMode
|
typedef |
AES256CTRMode
|
typedef |
EntropyFunct)(uint8_t *buf, size_t bufSize)
|
typedefint(*
用于从熵源收集随机数据的函数签名。 |
HKDFSHA1
|
typedef |
HKDFSHA256
|
typedef |
HMACSHA1
|
typedef |
HMACSHA256
|
typedef |
函数 |
|
---|---|
ClearSecretData(uint8_t *buf, uint32_t len)
|
NL_DLL_EXPORT void
清除内存区域
buf 的前 len 个字节。 |
ConstantTimeCompare(const uint8_t *buf1, const uint8_t *buf2, uint16_t len)
|
bool
比较内存区域
buf1 和内存区域 buf2 的前 len 个字节。 |
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)
|
生成 Weave 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)
|
验证 Weave RSA 签名。
|
枚举
X963EncodedPointFormat
X963EncodedPointFormat
类型定义符
AES128CTRDRBG
CTR_DRBG< Platform::Security::AES128BlockCipherEnc > AES128CTRDRBG
AES128CTR 模式
CTRMode< Platform::Security::AES128BlockCipherEnc > AES128CTRMode
AES256CTR 模式
CTRMode< Platform::Security::AES256BlockCipherEnc > AES256CTRMode
EntropyFunct
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
函数
ClearSecretData
NL_DLL_EXPORT void ClearSecretData( uint8_t *buf, uint32_t len )
清除内存区域 buf
的前 len
个字节。
在此实现中,内存区域 buf
的前 len
个字节用零填充。
详细信息 | |||||
---|---|---|---|---|---|
参数 |
|
ConstantTimeCompare
bool ConstantTimeCompare( const uint8_t *buf1, const uint8_t *buf2, uint16_t len )
比较内存区域 buf1
和内存区域 buf2
的前 len
个字节。
此函数所花费的时间与内存区域 buf1
和 buf2
中的数据无关。
详细信息 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
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 )
EncodeX962ECPoint
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 )
生成 Weave HMAC 签名并对其进行编码。
使用密钥为指定数据计算 HMAC 签名,并将签名以 Weave HMACSignature 结构的形式写入具有给定标记的 TLV 写入者。
详细信息 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||||||||
返回值 |
|
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 签名并对其进行编码。
使用给定的 X509 编码 RSA 私钥和消息哈希计算 RSA 签名,并以 Weave RSASignature 结构将签名写入具有给定标记的 TLV 写入者。
详细信息 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||||||||
返回值 |
|
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 )
获取椭圆曲线的大小(以字节为单位)。
详细信息 | |||
---|---|---|---|
参数 |
|
||
返回值 |
|
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 签名。
使用给定数据和用于验证签名的密钥验证 HMAC 签名。
详细信息 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||||||
返回值 |
|
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 签名。
使用给定的数据哈希值和 X509 编码的 RSA 证书(包含用于验证签名的公钥)验证 RSA 签名。
详细信息 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||||||
返回值 |
|