nl::Weave::Crypto

이 네임스페이스에는 공유 암호화 지원을 위해 Weave 내의 모든 인터페이스가 포함됩니다.

요약

열거

X963EncodedPointFormat enum

Typedef

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
메모리 영역 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 서명을 확인합니다.

클래스

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

열거형

X963EncodedPointFormat

 X963EncodedPointFormat

Typedef

AES128CTRDRBG

CTR_DRBG< Platform::Security::AES128BlockCipherEnc > AES128CTRDRBG

AES128CTRMode

CTRMode< Platform::Security::AES128BlockCipherEnc > AES128CTRMode

AES256CTRMode

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바이트가 0으로 채워집니다.

세부정보
매개변수
[in] buf
지워야 하는 보안 비밀 데이터가 포함된 메모리 버퍼를 가리키는 포인터입니다.
[in] len
보안 비밀 데이터의 크기를 바이트 단위로 지정합니다.

ConstantTimeCompare

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

메모리 영역 buf1과 메모리 영역 buf2의 처음 len바이트를 비교합니다.

이 함수에 소요되는 시간은 메모리 영역 buf1buf2의 데이터와 무관합니다.

세부정보
매개변수
[in] buf1
메모리 블록을 가리키는 포인터
[in] buf2
메모리 블록을 가리키는 포인터
[in] len
바이트 단위로 비교할 메모리 영역의 크기입니다.
반환 값
true
메모리 영역 buf1buf2의 처음 len바이트가 같을 경우
false
그렇지 않으면

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
)

디코딩 X962ECPoint

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

디코딩 X962ECPoint

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
)

인코딩 X962ECPoint

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 작성기에 씁니다.

세부정보
매개변수
[in] sigAlgoOID
HMAC 서명을 생성하는 데 사용할 알고리즘 OID
[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 서명을 생성하고 인코딩합니다.

지정된 X509로 인코딩된 RSA 비공개 키 및 메시지 해시를 사용하여 RSA 서명을 계산하고 서명을 지정된 TLV 작성기에 Weave RSASignature 구조로 작성합니다.

세부정보
매개변수
[in] sigAlgoOID
RSA 서명을 생성하는 데 사용되는 알고리즘 OID입니다.
[in] writer
인코딩된 서명을 작성해야 하는 TLVWriter 객체입니다.
[in] tag
TLV 태그를 사용하여 인코딩된 서명 구조와 연결할 수 있습니다.
[in] hash
서명할 데이터의 해시가 포함된 버퍼.
[in] hashLen
데이터 해시의 길이(바이트)입니다.
[in] keyDER
서명을 생성하는 데 사용할 비공개 키가 포함된 버퍼입니다. 비공개 키는 X509 RSA 비공개 키 구조로 인코딩되어야 합니다.
[in] keyDERLen
인코딩된 비공개 키의 길이(바이트)입니다.
반환 값
WEAVE_NO_ERROR
작업이 성공한 경우
other
비공개 키 디코딩, 서명 생성 또는 서명 인코딩과 관련된 기타 Weave 오류 코드입니다.

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
)

타원 곡선 크기 (바이트)를 가져옵니다.

세부정보
매개변수
[in] curveOID
지정된 타원 곡선 OID.
반환 값
Returns
지정된 곡선 OID가 지원되지 않는 타원 곡선이면 0입니다. 그렇지 않으면 곡선 크기를 바이트 단위로 반환합니다.

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 서명을 확인합니다.

세부정보
매개변수
[in] sigAlgoOID
HMAC 서명을 생성하는 데 사용할 알고리즘 OID
[in] data
서명할 데이터가 포함된 버퍼.
[in] dataLen
바이트 단위의 데이터 길이입니다.
[in] sig
확인할 인코딩된 HMAC 서명입니다.
[in] key
HMAC 서명을 생성하는 데 사용할 보안 비밀 키가 포함된 버퍼입니다.
[in] keyLen
보안 비밀 키의 길이(바이트)입니다.
반환 값
WEAVE_NO_ERROR
HMAC 서명 인증이 성공한 경우
WEAVE_ERROR_INVALID_SIGNATURE
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 서명을 확인합니다.

세부정보
매개변수
[in] sigAlgoOID
RSA 서명을 생성하는 데 사용되는 알고리즘 OID입니다.
[in] hash
서명할 데이터의 해시가 포함된 버퍼.
[in] hashLen
데이터 해시의 길이(바이트)입니다.
[in] sig
인코딩되어 확인해야 할 RSA 서명입니다.
[in] certDER
서명을 확인하는 데 사용할 공개 키가 있는 인증서가 포함된 버퍼입니다. 인증서는 X509 RSA 구조로 DER로 인코딩되어야 합니다.
[in] certDERLen
인코딩된 인증서의 길이(바이트)입니다.
반환 값
WEAVE_NO_ERROR
작업이 성공한 경우