Skip to content

Commit

Permalink
fix: security key and port (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhavilosetty-intel authored Mar 11, 2024
1 parent 36b25b8 commit 224e214
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 398 deletions.
42 changes: 0 additions & 42 deletions OpenAMTEnterpriseAssistant.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,8 @@
<HintPath>Dependencies\Interop.CERTCLILib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.IdentityModel.Abstractions, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.IdentityModel.Abstractions.7.2.0\lib\net472\Microsoft.IdentityModel.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.JsonWebTokens, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.IdentityModel.JsonWebTokens.7.2.0\lib\net472\Microsoft.IdentityModel.JsonWebTokens.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Tokens, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.IdentityModel.Tokens.7.2.0\lib\net472\Microsoft.IdentityModel.Tokens.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core">
Expand All @@ -115,37 +100,11 @@
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.Protocols" />
<Reference Include="System.Drawing" />
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\System.IdentityModel.Tokens.Jwt.7.2.0\lib\net472\System.IdentityModel.Tokens.Jwt.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Messaging" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Text.Encodings.Web, Version=4.0.5.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Json.4.7.2\lib\net461\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
Expand Down Expand Up @@ -229,7 +188,6 @@
<None Include="app.manifest">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
3 changes: 2 additions & 1 deletion src/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions src/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public partial class MainForm : Form
public string argUserName = null;
public string argPassword = null;
public string argSecurityKey = null;
public int argPort;
public string argAddress;
public string argDevNameType = null;
public string argCAName = null;
public string argCATemplate = null;
Expand Down Expand Up @@ -116,6 +118,8 @@ public MainForm(string[] args)
if (key == "user") { argUserName = val; argflags |= 2; }
if (key == "pass") { argPassword = val; argflags |= 4; }
if (key == "securityKey") { argSecurityKey = val; argflags |= 8; }
if (key == "port") { argPort = Convert.ToInt32(val.TrimEnd()); argflags |= 10; }
if (key == "address") { argAddress = val; argflags |= 12; }
if (key == "devnametype") { argDevNameType = val; }
if (key == "caname") { argCAName = val; }
if (key == "catemplate") { argCATemplate = val; }
Expand Down Expand Up @@ -305,20 +309,18 @@ private void connectToolStripMenuItem_Click(object sender, EventArgs e)
{
Log("Failed to Start websocket");
}

if (httpServer == null)
{
try
{
httpServer = new OpenAMTEnterpriseAssistantHttpServer(server);
httpServer.StartServer();
Log("Started httpServer...");
Log("Started httpServer: " + argAddress + ":" + argPort);
}
catch (Exception)
catch (Exception ex)
{
Log("Failed to Start httpServer");
Log("Failed to Start httpServer" + ex);
}

}
}

Expand Down Expand Up @@ -445,9 +447,9 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
if (key == "host") { f.host = val; }
if (key == "user") { f.user = val; }
if (key == "pass") { f.pass = val; }
if (key == "securitykey") {
f.securityKey = val;
}
if (key == "securitykey") { f.securityKey = val; }
if (key == "port") { f.port = Convert.ToInt32(val); }
if (key == "address") { f.address = val; }
if (key == "devnametype") { f.devNameType = val; }
if (key == "caname") { caname = val; }
if (key == "catemplate") { catemplate = val; }
Expand Down Expand Up @@ -478,6 +480,8 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
argUserName = f.user;
argPassword = f.pass;
argSecurityKey = f.securityKey;
argPort = f.port;
argAddress = f.address;
argDevNameType = f.devNameType;
if (f.caname != "") { argCAName = f.caname; } else { argCAName = null; }
argCATemplate = f.catemplate;
Expand All @@ -492,6 +496,8 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
config += "user=" + f.user + "\r\n";
config += "pass=" + f.pass + "\r\n";
config += "securityKey=" + f.securityKey + "\r\n";
config += "address=" + f.address + "\r\n";
config += "port=" + f.port + "\r\n";
config += "devNameType=" + f.devNameType + "\r\n";
if (f.caname != "") {
config += "caname=" + f.caname + "\r\n";
Expand Down
Loading

0 comments on commit 224e214

Please sign in to comment.