NL::编织::编织安全管理器

概括

构造函数和析构函数

WeaveSecurityManager (void)

公共类型

KeyErrorMsgRcvdFunct )(uint16_t keyId, uint8_t encType, uint32_t messageId, uint64_t peerNodeId, WEAVE_ERROR keyErr)类型定义
void(*
关键错误消息处理函数的类型。
KeyExportCompleteFunct )(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, uint32_t exportedKeyId, const uint8_t *exportedKey, uint16_t exportedKeyLen)类型定义
void(*
类型密钥导出协议完成处理功能。
KeyExportErrorFunct )(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, WEAVE_ERROR localErr, StatusReport *statusReport)类型定义
void(*
密钥导出协议错误处理函数的类型。
SessionErrorFunct )(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, WEAVE_ERROR localErr, uint64_t peerNodeId, StatusReport *statusReport)类型定义
void(*
SessionEstablishedFunct )(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, uint16_t sessionKeyId, uint64_t peerNodeId, uint8_t encType)类型定义
void(*
State枚举

公共属性

CASEUseKnownECDHKey
bool
ExchangeManager
FabricState
IdleSessionTimeout
uint32_t
InitiatorAllowedCASEConfigs
uint8_t
InitiatorAllowedCASECurves
uint8_t
InitiatorAllowedKeyExportConfigs
uint8_t
InitiatorCASEConfig
uint32_t
InitiatorCASECurveId
uint32_t
InitiatorKeyExportConfig
uint8_t
OnKeyErrorMsgRcvd
关键错误回调函数。
OnSessionError
SessionErrorFunct
OnSessionEstablished
SessionEstablishedFunct
ResponderAllowedCASEConfigs
uint8_t
ResponderAllowedCASECurves
uint8_t
ResponderAllowedKeyExportConfigs
uint8_t
SessionEstablishTimeout
uint32_t
State
uint8_t
mCASEEngine
mKeyExport
mPASEEngine
mStartKeyExport_OnComplete
密钥导出协议完成回调函数。
mStartKeyExport_OnError
密钥导出协议错误回调函数。
mStartKeyExport_ReqState
void *
mStartSecureSession_OnComplete
SessionEstablishedFunct
mStartSecureSession_OnError
SessionErrorFunct
mStartSecureSession_ReqState
void *
mTAKEEngine

公共职能

CancelSessionEstablishment (void *reqState)
取消正在进行的会话建立。
Init ( WeaveExchangeManager & aExchangeMgr, System::Layer & aSystemLayer)
IsKeyError ( WEAVE_ERROR err)
bool
检查指定的 Weave 错误代码是否是关键错误代码之一。
OnEncryptedMsgRcvd (uint16_t sessionKeyId, uint64_t peerNodeId, uint8_t encType)
void
ReleaseKey (uint64_t peerNodeId, uint16_t keyId)
void
释放消息加密密钥保留。
ReserveKey (uint64_t peerNodeId, uint16_t keyId)
void
对消息加密密钥进行保留。
SendKeyErrorMsg ( WeaveMessageInfo *rcvdMsgInfo, const IPPacketInfo *rcvdMsgPacketInfo, WeaveConnection *con, WEAVE_ERROR keyErr)
发送密钥错误消息。
SetCASEAuthDelegate ( WeaveCASEAuthDelegate *delegate)
void
SetKeyExportDelegate ( WeaveKeyExportDelegate *delegate)
void
SetTAKEAuthDelegate ( WeaveTAKEChallengerAuthDelegate *delegate)
void
SetTAKETokenAuthDelegate ( WeaveTAKETokenAuthDelegate *delegate)
void
Shutdown (void)
StartCASESession ( WeaveConnection *con, uint64_t peerNodeId, const IPAddress & peerAddr, uint16_t peerPort, WeaveAuthMode requestedAuthMode, void *reqState, SessionEstablishedFunct onComplete, SessionErrorFunct onError, WeaveCASEAuthDelegate *authDelegate, uint64_t terminatingNodeId)
调用此方法来建立新的或查找现有的 CASE 会话。
StartKeyExport ( WeaveConnection *con, uint64_t peerNodeId, const IPAddress & peerAddr, uint16_t peerPort, uint32_t keyId, bool signMessage, void *reqState, KeyExportCompleteFunct onComplete, KeyExportErrorFunct onError, WeaveKeyExportDelegate *keyExportDelegate)
StartPASESession ( WeaveConnection *con, WeaveAuthMode requestedAuthMode, void *reqState, SessionEstablishedFunct onComplete, SessionErrorFunct onError, const uint8_t *pw, uint16_t pwLen)
调用此方法来建立安全的 PASE 会话。
StartTAKESession ( WeaveConnection *con, WeaveAuthMode requestedAuthMode, void *reqState, SessionEstablishedFunct onComplete, SessionErrorFunct onError, bool encryptAuthPhase, bool encryptCommPhase, bool timeLimitedIK, bool sendChallengerId, WeaveTAKEChallengerAuthDelegate *authDelegate)
调用此方法来建立安全的 TAKE 会话。

公共类型

KeyErrorMsgRcvdFunct

void(* KeyErrorMsgRcvdFunct)(uint16_t keyId, uint8_t encType, uint32_t messageId, uint64_t peerNodeId, WEAVE_ERROR keyErr)

关键错误消息处理函数的类型。

细节
参数
[in] keyId
加密密钥导致来自对等方的密钥错误消息响应。
[in] encType
keyid的相关加密类型。
[in] messageId
Weave 消息的标识符导致来自对等方的密钥错误响应。
[in] peerNodeId
发送关键错误消息的 Weave 节点的标识符。
[in] keyErr
从对等方收到的错误代码。

KeyExportCompleteFunct

void(* KeyExportCompleteFunct)(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, uint32_t exportedKeyId, const uint8_t *exportedKey, uint16_t exportedKeyLen)

类型密钥导出协议完成处理功能。

细节
参数
[in] sm
一个指针,指向WeaveSecurityManager对象。
[in] con
一个指针,指向WeaveConnection对象。
[in] reqState
指向密钥导出请求者状态的指针。
[in] keyId
导出的密钥 ID。
[in] exportedKey
指向导出的密钥的指针。
[in] exportedKeyLen
对导出的密钥长度的引用。

KeyExportErrorFunct

void(* KeyExportErrorFunct)(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, WEAVE_ERROR localErr, StatusReport *statusReport)

密钥导出协议错误处理函数的类型。

细节
参数
[in] sm
一个指针,指向WeaveSecurityManager对象。
[in] con
一个指针,指向WeaveConnection对象。
[in] reqState
指向密钥导出请求者状态的指针。
[in] localErr
在密钥导出协议期间遇到 WEAVE_ERROR。
[in] statusReport
如果从对等方接收到错误状态,则指向 StatusReport 对象的指针。

会话错误函数

void(* SessionErrorFunct)(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, WEAVE_ERROR localErr, uint64_t peerNodeId, StatusReport *statusReport)

SessionEstablishedFunct

void(* SessionEstablishedFunct)(WeaveSecurityManager *sm, WeaveConnection *con, void *reqState, uint16_t sessionKeyId, uint64_t peerNodeId, uint8_t encType)

状态

 State

公共属性

CASEUseKnownECDHKey

bool CASEUseKnownECDHKey

交换管理器

WeaveExchangeManager * ExchangeManager

织物状态

WeaveFabricState * FabricState

空闲会话超时

uint32_t IdleSessionTimeout

InitiatorAllowedCASEConfigs

uint8_t InitiatorAllowedCASEConfigs

InitiatorAllowedCASECurves

uint8_t InitiatorAllowedCASECurves

InitiatorAllowedKeyExportConfigs

uint8_t InitiatorAllowedKeyExportConfigs

启动器CASEConfig

uint32_t InitiatorCASEConfig

启动器CASECurveId

uint32_t InitiatorCASECurveId

InitiatorKeyExportConfig

uint8_t InitiatorKeyExportConfig

OnKeyErrorMsgRcvd

KeyErrorMsgRcvdFunct OnKeyErrorMsgRcvd

关键错误回调函数。

当收到关键错误消息时调用此函数。

会话错误

SessionErrorFunct OnSessionError

会话建立

SessionEstablishedFunct OnSessionEstablished

ResponderAllowedCASEConfigs

uint8_t ResponderAllowedCASEConfigs

ResponderAllowedCASECurves

uint8_t ResponderAllowedCASECurves

ResponderAllowedKeyExportConfigs

uint8_t ResponderAllowedKeyExportConfigs

会话建立超时

uint32_t SessionEstablishTimeout

状态

uint8_t State

mCASE引擎

WeaveCASEEngine * mCASEEngine

密钥导出

WeaveKeyExport * mKeyExport

mPASE引擎

WeavePASEEngine * mPASEEngine

mStartKeyExport_OnComplete

KeyExportCompleteFunct mStartKeyExport_OnComplete

密钥导出协议完成回调函数。

当密钥导出过程完成时调用此函数。

mStartKeyExport_OnError

KeyExportErrorFunct mStartKeyExport_OnError

密钥导出协议错误回调函数。

当密钥导出过程中遇到错误时调用此函数。

mStartKeyExport_ReqState

void * mStartKeyExport_ReqState

mStartSecureSession_OnComplete

SessionEstablishedFunct mStartSecureSession_OnComplete

mStartSecureSession_OnError

SessionErrorFunct mStartSecureSession_OnError

mStartSecureSession_ReqState

void * mStartSecureSession_ReqState

mTAKE引擎

WeaveTAKEEngine * mTAKEEngine

公共职能

取消会话建立

WEAVE_ERROR CancelSessionEstablishment(
  void *reqState
)

取消正在进行的会话建立。

细节
参数
[in] reqState
与会话启动时应用程序提供的值相匹配的指针值。
返回值
WEAVE_NO_ERROR
如果找到并取消匹配的正在进行的会话建立。
WEAVE_ERROR_INCORRECT_STATE
如果没有正在进行的会话建立,或者正在进行的会话与提供的请求状态指针不匹配。

在里面

WEAVE_ERROR Init(
  WeaveExchangeManager & aExchangeMgr,
  System::Layer & aSystemLayer
)

键错误

bool IsKeyError(
  WEAVE_ERROR err
)

检查指定的 Weave 错误代码是否是关键错误代码之一。

调用此函数以确定是否应将密钥错误消息发送给在解码过程中未能找到正确密钥的消息的发起方。

细节
参数
[in] err
编织错误代码。
返回值
true
如果指定 Weave 错误代码是关键错误。
false
除此以外。

OnEncryptedMsgRcvd

void OnEncryptedMsgRcvd(
  uint16_t sessionKeyId,
  uint64_t peerNodeId,
  uint8_t encType
)

释放键

void ReleaseKey(
  uint64_t peerNodeId,
  uint16_t keyId
)

释放消息加密密钥保留。

释放先前放置在消息加密密钥上的保留。

对于放置在一个特定的键的每个预订,则ReleaseKey()方法,必须调用不超过一次。

此方法接受任何形式的密钥 ID,包括 None。未命名实际密钥的密钥 ID 将被忽略。

细节
参数
[in] peerNodeId
与密钥共享的对等方的 Weave 节点 ID。
[in] keyId
应释放其保留的密钥的 id。

保留密钥

void ReserveKey(
  uint64_t peerNodeId,
  uint16_t keyId
)

对消息加密密钥进行保留。

密钥保留用于表示特定密钥正在使用中并应保留。请注意,对密钥进行保留并不能保证该密钥不会被显式操作(例如接收 KeyError 消息)删除。

对于放置在一个特定的键的每个预订,到相应的呼叫ReleaseKey()必须进行。

此方法接受任何形式的密钥 ID,包括 None。未命名实际密钥的密钥 ID 将被忽略。

细节
参数
[in] peerNodeId
与密钥共享的对等方的 Weave 节点 ID。
[in] keyId
要保留的密钥的 id。

发送密钥错误消息

WEAVE_ERROR SendKeyErrorMsg(
  WeaveMessageInfo *rcvdMsgInfo,
  const IPPacketInfo *rcvdMsgPacketInfo,
  WeaveConnection *con,
  WEAVE_ERROR keyErr
)

发送密钥错误消息。

当接收到的 Weave 消息由于密钥错误解码失败时调用此函数。

细节
参数
[in] rcvdMsgInfo
指向接收到的 Weave 消息的消息信息的指针。
[in] rcvdMsgPacketInfo
指向接收到的 Weave 消息的 IPPacketInfo 对象的指针。
[in] con
的指针WeaveConnection对象。
[in] keyErr
编织键错误代码。
返回值
WEAVE_ERROR_NO_MEMORY
如果无法为新的交换上下文或新的消息缓冲区分配内存。
WEAVE_ERROR_BUFFER_TOO_SMALL
如果缓冲区太小
WEAVE_NO_ERROR
如果方法成功。

设置CASEAuthDelegate

void SetCASEAuthDelegate(
  WeaveCASEAuthDelegate *delegate
)

SetKeyExportDelegate

void SetKeyExportDelegate(
  WeaveKeyExportDelegate *delegate
)

设置TAKEAuthDelegate

void SetTAKEAuthDelegate(
  WeaveTAKEChallengerAuthDelegate *delegate
)

设置TAKETokenAuthDelegate

void SetTAKETokenAuthDelegate(
  WeaveTAKETokenAuthDelegate *delegate
)

关掉

WEAVE_ERROR Shutdown(
  void
)

开始CASE会话

WEAVE_ERROR StartCASESession(
  WeaveConnection *con,
  uint64_t peerNodeId,
  const IPAddress & peerAddr,
  uint16_t peerPort,
  WeaveAuthMode requestedAuthMode,
  void *reqState,
  SessionEstablishedFunct onComplete,
  SessionErrorFunct onError,
  WeaveCASEAuthDelegate *authDelegate,
  uint64_t terminatingNodeId
)

调用此方法来建立新的或查找现有的 CASE 会话。

细节
参数
[in] con
的指针WeaveConnection对象。
[in] peerNodeId
对等体的节点标识符。
[in] peerAddr
对等节点的 IP 地址。
[in] peerPort
对等节点的端口。
[in] requestedAuthMode
对等方进行身份验证所需的方法。这必须是 CASE 身份验证模式之一。
[in] reqState
指向请求者状态的指针。
[in] onComplete
指向回调函数的指针,一旦请求的安全会话建立,就会调用该函数。
[in] onError
指向回调函数的指针,如果请求的会话建立失败,将调用该函数。
[in] authDelegate
指向 CASE 身份验证委托对象的指针。
[in] terminatingNodeId
会话终止节点的节点标识符。当此输入与指示请求共享安全会话的 kNodeIdNotSpecified 不同时。
返回值
WEAVE_NO_ERROR
关于成功。

开始密钥导出

WEAVE_ERROR StartKeyExport(
  WeaveConnection *con,
  uint64_t peerNodeId,
  const IPAddress & peerAddr,
  uint16_t peerPort,
  uint32_t keyId,
  bool signMessage,
  void *reqState,
  KeyExportCompleteFunct onComplete,
  KeyExportErrorFunct onError,
  WeaveKeyExportDelegate *keyExportDelegate
)

开始PASE会话

WEAVE_ERROR StartPASESession(
  WeaveConnection *con,
  WeaveAuthMode requestedAuthMode,
  void *reqState,
  SessionEstablishedFunct onComplete,
  SessionErrorFunct onError,
  const uint8_t *pw,
  uint16_t pwLen
)

调用此方法来建立安全的 PASE 会话。

细节
参数
[in] con
的指针WeaveConnection对象。
[in] requestedAuthMode
对等方进行身份验证所需的方法。这必须是 PASE 身份验证模式之一。
[in] reqState
指向请求者状态的指针。
[in] onComplete
指向回调函数的指针,一旦请求的安全会话建立,就会调用该函数。
[in] onError
指向回调函数的指针,如果请求的会话建立失败,将调用该函数。
[in] pw
指向 PASE 秘密密码的指针。
[in] pwLen
PASE 密码的长度。
返回值
WEAVE_NO_ERROR
关于成功。

开始TAKE会话

WEAVE_ERROR StartTAKESession(
  WeaveConnection *con,
  WeaveAuthMode requestedAuthMode,
  void *reqState,
  SessionEstablishedFunct onComplete,
  SessionErrorFunct onError,
  bool encryptAuthPhase,
  bool encryptCommPhase,
  bool timeLimitedIK,
  bool sendChallengerId,
  WeaveTAKEChallengerAuthDelegate *authDelegate
)

调用此方法来建立安全的 TAKE 会话。

细节
参数
[in] con
的指针WeaveConnection对象。
[in] requestedAuthMode
对等方进行身份验证所需的方法。这必须是 TAKE 身份验证模式之一。
[in] reqState
指向请求者状态的指针。
[in] onComplete
指向回调函数的指针,一旦请求的安全会话建立,就会调用该函数。
[in] onError
指向回调函数的指针,如果请求的会话建立失败,将调用该函数。
[in] encryptAuthPhase
一个布尔标志,指示是否应加密协议身份验证阶段。
[in] encryptCommPhase
一个布尔标志,指示是否应加密协议通信阶段。
[in] timeLimitedIK
指示标识密钥 (IK) 是否有时间限制的布尔标志。
[in] sendChallengerId
一个布尔标志,指示是否应在消息中包含挑战者标识。如果未包含,则 Weave 节点 ID 值将用作挑战者 ID。
[in] authDelegate
指向 TAKE 挑战者身份验证委托对象的指针。
返回值
WEAVE_NO_ERROR
关于成功。

编织安全管理器

 WeaveSecurityManager(
  void
)