private void OnStart(StartActionUnit ou) { if (_securityManagerInfo.DelaysS0.ContainsKey(SecurityS0Delays.NonceGet)) { Thread.Sleep(_securityManagerInfo.DelaysS0[SecurityS0Delays.NonceGet]); } }
private void OnStart(StartActionUnit ou) { if (SendInclusionComplete.StepId == 0x01) { _securityTestSettingsService.ActivateTestPropertiesForFrame(SecurityS2TestFrames.InclusionComplete1, _sendInclusionComplete); } else if (SendInclusionComplete.StepId == 0x02) { _securityTestSettingsService.ActivateTestPropertiesForFrame(SecurityS2TestFrames.InclusionComplete2, _sendInclusionComplete); } }
private void OnStart(StartActionUnit ou) { if (RequestInclusionSupport.StepId == 0x01) { _securityTestSettingsService.ActivateTestPropertiesForFrame(SecurityS2TestFrames.InclusionInititate1, _requestInclusionSupport); } else if (RequestInclusionSupport.StepId == 0x02) { _securityTestSettingsService.ActivateTestPropertiesForFrame(SecurityS2TestFrames.InclusionInititate2, _requestInclusionSupport); } }
private void OnStart(StartActionUnit ou) { ExpectData.DestNodeId = SrcNodeId; ExpectData.RxStatuses = RxStatuses; ExpectData.IgnoreRxStatuses = IgnoreRxStatuses; _sendData.NodeId = DestNodeId; _sendData.Data = Data; _sendData.DataDelay = DataDelay; _sendDataBridge.DestNodeId = DestNodeId; _sendDataBridge.SrcNodeId = SrcNodeId; _sendDataBridge.Data = Data; }
private void OnStart(StartActionUnit unit) { List <ActionBase> nextItems = new List <ActionBase>(5); if (_securityManagerInfo.Network.IsEnabledS0) { nextItems.Add(_expectSchemeGet); } if (_securityManagerInfo.Network.IsEnabledS2_ACCESS || _securityManagerInfo.Network.IsEnabledS2_AUTHENTICATED || _securityManagerInfo.Network.IsEnabledS2_UNAUTHENTICATED) { nextItems.Add(_expectKexGet); } nextItems.Add(_learnMode); unit.SetNextActionItems(nextItems.ToArray()); }
private void PrepareRequestNetworkKey(StartActionUnit ou) { if (SupportedSecuritySchemes == 0) { _securityManagerInfo.ActivateNetworkKeyS0Temp(); requestNetworkKey.DestNodeId = NodeId; requestNetworkKey.SrcNodeId = VirtualNodeId; ou.SetNextActionItems(requestNetworkKey); if (_securityManagerInfo.DelaysS0.ContainsKey(SecurityS0Delays.SchemeReport)) { Thread.Sleep(_securityManagerInfo.DelaysS0[SecurityS0Delays.SchemeReport]); } } else { SpecificResult.SubstituteStatus = SubstituteStatuses.Failed; SetStateCompletedSecurityFailed(ou); } }
private void OnAddNodeCompletedInternal(StartActionUnit tu) { SpecificResult.Id = _initiateNodeId; var rniRes = SpecificResult.FindInnerResults <RequestNodeInfoResult>(); if (rniRes != null && rniRes.Count > 0) { SpecificResult.CommandClasses = rniRes[0].CommandClasses; SpecificResult.IsSlave = rniRes[0].Basic > 2; SpecificResult.Basic = rniRes[0].Basic; SpecificResult.Generic = rniRes[0].Generic; SpecificResult.Specific = rniRes[0].Specific; SecurityManagerInfo.Network.SetCommandClasses(new NodeTag(SpecificResult.Id), SpecificResult.CommandClasses); } SpecificResult.SubstituteStatus = SubstituteStatuses.Failed; requestScheme.DestNodeId = SpecificResult.Id; if (SecurityManagerInfo.DelaysS0.ContainsKey(SecurityS0Delays.SchemeGet)) { Thread.Sleep(SecurityManagerInfo.DelaysS0[SecurityS0Delays.SchemeGet]); } }
private void OnStart(StartActionUnit taskUnit) { #region NonceGet _securityTestSettingsService.ActivateTestPropertiesForFrame(SecurityS2TestFrames.NonceGet, _requestNonce); #endregion }
private void OnSchemeGet(StartActionUnit ou) { SpecificResult.SubstituteStatus = SubstituteStatuses.Failed; _securityManagerInfo.IsInclusion = true; PrepareRequestNetworkKey(ou); }
private void OnStart(StartActionUnit ou) { //mController.ResetNodeStatusSignals(); }
private void OnKEXGet(StartActionUnit ou) { kexReportStart = DateTime.Now; SpecificResult.SubstituteStatus = SubstituteStatuses.Failed; _securityManagerInfo.IsInclusion = true; _KexFailCancel.NodeId = NodeId; _KexFailCancel.BridgeNodeId = VirtualNodeId; _KEXReportKEXSet.DestNodeId = NodeId; _KEXReportKEXSet.SrcNodeId = VirtualNodeId; if (VirtualNodeId == 0) { _peerNodeId = new InvariantPeerNodeId(_securityManagerInfo.Network.NodeId, NodeId); } else { _peerNodeId = new InvariantPeerNodeId(VirtualNodeId, NodeId); } var cmd = new COMMAND_CLASS_SECURITY_2.KEX_REPORT(); _isClientSideAuthRequested = _securityManagerInfo.TestEnableClientSideAuthS2; cmd.properties1 = new COMMAND_CLASS_SECURITY_2.KEX_REPORT.Tproperties1() { requestCsa = _isClientSideAuthRequested ? (byte)1 : (byte)0 }; byte keysToRequest = (byte)(NetworkKeyS2Flags.S2Class0 | NetworkKeyS2Flags.S2Class1 | NetworkKeyS2Flags.S2Class2 | NetworkKeyS2Flags.S0); if (!_securityManagerInfo.Network.IsEnabledS0) { keysToRequest = (byte)(keysToRequest & ~(byte)(NetworkKeyS2Flags.S0)); } if (!_securityManagerInfo.Network.IsEnabledS2_UNAUTHENTICATED) { keysToRequest = (byte)(keysToRequest & ~(byte)(NetworkKeyS2Flags.S2Class0)); } if (!_securityManagerInfo.Network.IsEnabledS2_AUTHENTICATED) { keysToRequest = (byte)(keysToRequest & ~(byte)(NetworkKeyS2Flags.S2Class1)); } if (!_securityManagerInfo.Network.IsEnabledS2_ACCESS) { keysToRequest = (byte)(keysToRequest & ~(byte)(NetworkKeyS2Flags.S2Class2)); } cmd.requestedKeys = keysToRequest; cmd.supportedEcdhProfiles = 1; cmd.supportedKexSchemes = 2; _KEXReportKEXSet.Data = cmd; #region KEXReport if (_securityManagerInfo.TestFramesS2.ContainsKey(SecurityS2TestFrames.KEXReport)) { var testFrame = _securityManagerInfo.TestFramesS2[SecurityS2TestFrames.KEXReport]; if (testFrame.Command != null && testFrame.Command.Length > 5 && testFrame.Command[0] == COMMAND_CLASS_SECURITY_2.ID && testFrame.Command[1] == COMMAND_CLASS_SECURITY_2.KEX_REPORT.ID) { COMMAND_CLASS_SECURITY_2.KEX_REPORT tmp = testFrame.Command; keysToRequest = tmp.requestedKeys; } _securityTestSettingsService.ActivateTestPropertiesForFrame(SecurityS2TestFrames.KEXReport, _KEXReportKEXSet); } #endregion var duration = (int)(DateTime.Now - kexReportStart).TotalMilliseconds; if (duration > InclusionS2TimeoutConstants.Joining.PublicKeyReport) { _KEXReportKEXSet.SetNewExpectTimeout(100); } }
private void OnStart(StartActionUnit ou) { }
private void OnStart(StartActionUnit ou) { expectData.SrcNodeId = SrcNodeId; sendData.NodeId = DestNodeId; sendData.Data = Data; }
private void OnAddNodeCompleted(StartActionUnit tu) { SecurityManagerInfo.IsInclusion = true; if ((ParentAction as ActionSerialGroup) != null) { ActionSerialGroup actionGroup = (ActionSerialGroup)ParentAction; if (_initiateNodeId > 0) { OnAddNodeCompletedInternal(tu); } else { ActionResult agRes = ParentAction.Result; AddTraceLogItems(agRes.InnerResults[0].TraceLog); if (agRes.InnerResults[0].State == ActionStates.Completed) { AddRemoveNodeResult arnRes = agRes.InnerResults[0] as AddRemoveNodeResult; SpecificResult.Id = arnRes.Id; SpecificResult.Basic = arnRes.Basic; SpecificResult.Generic = arnRes.Generic; SpecificResult.Specific = arnRes.Specific; SpecificResult.AddRemoveNodeStatus = arnRes.AddRemoveNodeStatus; if (arnRes.CommandClasses == null) { var rniRes = agRes.FindInnerResults <RequestNodeInfoResult>(); if (rniRes != null && rniRes.Count > 0) { SpecificResult.CommandClasses = rniRes[0].CommandClasses; SpecificResult.IsSlave = rniRes[0].Basic > 2; } } else { SpecificResult.CommandClasses = arnRes.CommandClasses; SpecificResult.IsSlave = arnRes.IsSlave; } SecurityManagerInfo.Network.SetCommandClasses(new NodeTag(SpecificResult.Id), SpecificResult.CommandClasses); if (actionGroup.Actions != null && actionGroup.Actions.Length > 0 && actionGroup.Actions[0] is ReplaceFailedNodeOperation) { SecurityManagerInfo.Network.ResetSecuritySchemes(SpecificResult.Id); } if (SpecificResult.SubstituteStatus == SubstituteStatuses.None && (!SecurityManagerInfo.CheckIfSupportSecurityCC || (SpecificResult.CommandClasses != null && SpecificResult.CommandClasses.Contains(COMMAND_CLASS_SECURITY.ID)))) { if (SecurityManagerInfo.Network.HasSecurityScheme(SpecificResult.Id, SecuritySchemes.S0) || arnRes.AddRemoveNodeStatus == AddRemoveNodeStatuses.Replicated) { SetStateCompleted(tu); SpecificResult.SubstituteStatus = SubstituteStatuses.Done; } else { if (SpecificResult.tmpSkipS0) { SetStateCompleted(tu); } else { SpecificResult.SubstituteStatus = SubstituteStatuses.Failed; requestScheme.DestNodeId = SpecificResult.Id; if (SecurityManagerInfo.DelaysS0.ContainsKey(SecurityS0Delays.SchemeGet)) { Thread.Sleep(SecurityManagerInfo.DelaysS0[SecurityS0Delays.SchemeGet]); } } } } else { if (SpecificResult.SubstituteStatus != SubstituteStatuses.Done && SecurityManagerInfo.CheckIfSupportSecurityCC && SpecificResult.CommandClasses != null && !SpecificResult.CommandClasses.Contains(COMMAND_CLASS_SECURITY.ID)) { SecurityManagerInfo.Network.ResetSecuritySchemes(SpecificResult.Id); } SetStateCompleted(tu); } } else { SetStateFailed(tu); } } } else { SetStateFailed(tu); } }