static void GenerateKeys(SECURITY_KEY_INDEX key, string ipAddress) { FreeformSecurityTableCollection host = ExecutionStepFactory.Current.GetSecurityTables(ipAddress); FreeformSecurityTableCollection gmu = new FreeformSecurityTableCollection(); byte[] gmuPartialKey = gmu.CreatePartialKeyGmu(key); byte[] hostPartialKey = host.CreatePartialKeyHost(key); gmu.StoreOtherPartialKeyGmu(key, hostPartialKey); host.StoreOtherPartialKeyHost(key, gmuPartialKey); if (host.CreateCommonKey(key) && gmu.CreateCommonKey(key)) { Console.WriteLine("Successfully created the common keys for : " + key.ToString()); //Console.WriteLine("Enter a string to encrypt?"); //string data = Console.ReadLine(); //byte[] original = Encoding.ASCII.GetBytes(data); //byte[] original2 = Encoding.ASCII.GetBytes(data); //gmu.EncryptGmu(key, ref original); //string data1 = Encoding.ASCII.GetString(original); //host.DecryptHost(key, ref original); //string data2 = Encoding.ASCII.GetString(original); //Console.WriteLine(key.ToString() + ", Local Partial Key : " + host[key].LocalPartialKey.GetConvertBytesToHexString(string.Empty)); //Console.WriteLine(key.ToString() + ", Other Partial Key : " + host[key].OtherPartialKey.GetConvertBytesToHexString(string.Empty)); //Console.WriteLine(key.ToString() + ", Common Key : " + host[key].CommonKey.GetConvertBytesToHexString(string.Empty)); //Console.WriteLine(key.ToString() + ", Original : " + data); //Console.WriteLine(key.ToString() + ", Encrypted : " + data1); //Console.WriteLine(key.ToString() + ", Decrypted : " + data2); } }
internal _FFMsgHandlerFactory(string key, IFFMsgTransmitter msgTransmitter, FFTgtHandlerDeviceTypes deviceType, List <ExCommsExecutionStepEntity> entities, FreeformSecurityTableCollection securityTables) { _key = key; _msgHandler = new FFMsgHandler(this, deviceType, msgTransmitter); _entities = entities; _securityTables = securityTables; }
internal _FFMsgHandlerFactory(string key, IFFMsgTransmitter msgTransmitter, FFTgtHandlerDeviceTypes deviceType, List<ExCommsExecutionStepEntity> entities, FreeformSecurityTableCollection securityTables) { _key = key; _msgHandler = new FFMsgHandler(this, deviceType, msgTransmitter); _entities = entities; _securityTables = securityTables; }
//internal _ExecutionStepFactory(List<ExCommsExecutionStepEntity> entities, // StringConcurrentDictionary<bool> gmuExecutionStepsExecuting) internal _ExecutionStepFactory(string key, List <ExCommsExecutionStepEntity> entities, FreeformSecurityTableCollection securityTables) { //_gmuExecutionSteps = new StringConcurrentDictionary<ExecutionStepDictionary>(); //_gmuExecutionStepsExecuting = gmuExecutionStepsExecuting; _key = key; _entities = entities; _securityTables = securityTables; _executionSteps = new ExecutionStepDictionary(); _executionSteps.Entity.GmuIpAddress = key; _messageWiseSteps = new StringConcurrentDictionary <ExecutionStepCollection>(); _requestResponseMappings = new DoubleKeyConcurrentDictionary <string, string, RequestResponseMapItem>( null, StringComparer.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase); _groupedSteps = new ExecutionStepGroupedDictionary(); this.CreateExecutionSteps(); }
//internal _ExecutionStepFactory(List<ExCommsExecutionStepEntity> entities, // StringConcurrentDictionary<bool> gmuExecutionStepsExecuting) internal _ExecutionStepFactory(string key, List<ExCommsExecutionStepEntity> entities, FreeformSecurityTableCollection securityTables) { //_gmuExecutionSteps = new StringConcurrentDictionary<ExecutionStepDictionary>(); //_gmuExecutionStepsExecuting = gmuExecutionStepsExecuting; _key = key; _entities = entities; _securityTables = securityTables; _executionSteps = new ExecutionStepDictionary(); _executionSteps.Entity.GmuIpAddress = key; _messageWiseSteps = new StringConcurrentDictionary<ExecutionStepCollection>(); _requestResponseMappings = new DoubleKeyConcurrentDictionary<string, string, RequestResponseMapItem>( null, StringComparer.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase); _groupedSteps = new ExecutionStepGroupedDictionary(); this.CreateExecutionSteps(); }