[성현모] CPMeta , Netstandard 오류 수정
This commit is contained in:
@ -12,6 +12,20 @@ namespace CPMeta
|
|||||||
public class CPMeta
|
public class CPMeta
|
||||||
{
|
{
|
||||||
public static int Port { get; set; } = 9000;
|
public static int Port { get; set; } = 9000;
|
||||||
|
public static int TimeOut { get; set; } = 3000;
|
||||||
|
|
||||||
|
public CPMeta()
|
||||||
|
{
|
||||||
|
RestAPI.TimeOut = TimeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<string> HealthCheck(string host)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/CPMeta/Health/health";
|
||||||
|
|
||||||
|
var res = await RestAPI.GetAsync<string>(url);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<Response_SetWbmsMeta> SetWbmsMetaAsync(string host, Request_SetWbmsMeta request)
|
public static async Task<Response_SetWbmsMeta> SetWbmsMetaAsync(string host, Request_SetWbmsMeta request)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CPMeta
|
namespace CPMeta
|
||||||
@ -13,12 +14,14 @@ namespace CPMeta
|
|||||||
private static HttpClient RequestClient = new HttpClient();
|
private static HttpClient RequestClient = new HttpClient();
|
||||||
private static HttpClient ResponseClient = new HttpClient();
|
private static HttpClient ResponseClient = new HttpClient();
|
||||||
|
|
||||||
|
public static int TimeOut { get; set; } = 3000;
|
||||||
|
|
||||||
static RestAPI()
|
static RestAPI()
|
||||||
{
|
{
|
||||||
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
|
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
|
||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||||
RequestClient.Timeout = TimeSpan.FromMilliseconds(10000);
|
|
||||||
ResponseClient.Timeout = TimeSpan.FromMilliseconds(10000);
|
RequestClient.Timeout = TimeSpan.FromMilliseconds(TimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<RESPONSE> PostAsync<REQUEST,RESPONSE>(string Url, REQUEST body) where REQUEST : class where RESPONSE : class
|
public static async Task<RESPONSE> PostAsync<REQUEST,RESPONSE>(string Url, REQUEST body) where REQUEST : class where RESPONSE : class
|
||||||
@ -27,9 +30,12 @@ namespace CPMeta
|
|||||||
{
|
{
|
||||||
if (body != null)
|
if (body != null)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"PostAsync:{Url},{JsonConvert.SerializeObject(body, Formatting.Indented)}");
|
||||||
|
|
||||||
var jsonBody = JsonConvert.SerializeObject(body);
|
var jsonBody = JsonConvert.SerializeObject(body);
|
||||||
var contents = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
var contents = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
//RequestClient.Timeout = TimeSpan.FromMilliseconds(TimeOut);
|
||||||
var response = await RequestClient.PostAsync(Url, contents);
|
var response = await RequestClient.PostAsync(Url, contents);
|
||||||
|
|
||||||
var resContentStr = await response.Content.ReadAsStringAsync();
|
var resContentStr = await response.Content.ReadAsStringAsync();
|
||||||
@ -38,6 +44,7 @@ namespace CPMeta
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"TimeOut: {ResponseClient.Timeout}");
|
||||||
Console.WriteLine("PostAsync Error");
|
Console.WriteLine("PostAsync Error");
|
||||||
Console.WriteLine(e.Message);
|
Console.WriteLine(e.Message);
|
||||||
}
|
}
|
||||||
@ -49,6 +56,9 @@ namespace CPMeta
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"GetAsync:{Url}");
|
||||||
|
|
||||||
|
//ResponseClient.Timeout = TimeSpan.FromMilliseconds(TimeOut);
|
||||||
var response = await ResponseClient.GetAsync(Url);
|
var response = await ResponseClient.GetAsync(Url);
|
||||||
|
|
||||||
var resContentStr = await response.Content.ReadAsStringAsync();
|
var resContentStr = await response.Content.ReadAsStringAsync();
|
||||||
@ -57,6 +67,7 @@ namespace CPMeta
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"TimeOut: {ResponseClient.Timeout}");
|
||||||
Console.WriteLine("GetAsync Error");
|
Console.WriteLine("GetAsync Error");
|
||||||
Console.WriteLine(e.Message);
|
Console.WriteLine(e.Message);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,9 +33,6 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="CPMeta">
|
|
||||||
<HintPath>.\CPMeta.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -57,6 +54,10 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\CPMeta\CPMeta.csproj">
|
||||||
|
<Project>{0bdb3e8c-2f57-4780-8b6f-3ae3f426a6c3}</Project>
|
||||||
|
<Name>CPMeta</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\KmsProxy\KmsProxy.csproj">
|
<ProjectReference Include="..\KmsProxy\KmsProxy.csproj">
|
||||||
<Project>{73824acb-4fb9-4e11-9a86-e05471b3c979}</Project>
|
<Project>{73824acb-4fb9-4e11-9a86-e05471b3c979}</Project>
|
||||||
<Name>KmsProxy</Name>
|
<Name>KmsProxy</Name>
|
||||||
|
|||||||
@ -12,80 +12,98 @@ namespace PlayGround.NetFramework
|
|||||||
//global set
|
//global set
|
||||||
string host = "192.168.0.43";
|
string host = "192.168.0.43";
|
||||||
|
|
||||||
|
//random value
|
||||||
|
string ProductId = "00010032-87a4-45ca-b627-b975d41e35df";
|
||||||
|
// string Mac1 = Guid.NewGuid().ToString();
|
||||||
|
// string Mac2 = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
//Get
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
//1. ecuid
|
var res2 = await CPMeta.CPMeta.GetWbmsMetaByProductId(host, ProductId);
|
||||||
var resEcuid = await KmsProxy.KmsProxy.EcuID_SupplierEcuID(host, new KmsProxy.Models.EcuID.Request_SupplierEcuID
|
// var res3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress(host, Mac1);
|
||||||
{
|
// var res4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress(host, Mac2);
|
||||||
EcuID = ""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(resEcuid, Formatting.Indented));
|
|
||||||
|
|
||||||
//2. master ecu key
|
|
||||||
var resMasterKeyProvisioning = await KmsProxy.KmsProxy.MasterEcuKey_SupplierKeyProvisioning(host, new KmsProxy.Models.MasterEcuKey.Request_SupplierKeyProvisioning
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(resMasterKeyProvisioning, Formatting.Indented));
|
|
||||||
|
|
||||||
var resMasterKeyProvisioningResult = await KmsProxy.KmsProxy.MasterEcuKey_SupplierKeyProvisioningResult(host, new KmsProxy.Models.MasterEcuKey.Request_SupplierKeyProvisioning_Result
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(resMasterKeyProvisioningResult, Formatting.Indented));
|
|
||||||
|
|
||||||
//3. SupplierSymmKey
|
|
||||||
var symmKeyProvisioning = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeyProvisioning(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeyProvisioning
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(symmKeyProvisioning, Formatting.Indented));
|
|
||||||
|
|
||||||
var symmKeyProvisioningResult = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeyProvisioningResult(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeyProvisioning_Result
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(symmKeyProvisioningResult, Formatting.Indented));
|
|
||||||
|
|
||||||
var symmKeySync = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeySyncValue(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeySyncValue
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(symmKeySync, Formatting.Indented));
|
|
||||||
|
|
||||||
var symmKeySyncResult = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeySyncValueResult(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeySyncValue_Result
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(symmKeySyncResult, Formatting.Indented));
|
|
||||||
|
|
||||||
//4. SecOCKey
|
|
||||||
var secOcKeyProvisioning = await KmsProxy.KmsProxy.SecOCKey_SupplierKeyProvisioning(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeyProvisioning
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(secOcKeyProvisioning, Formatting.Indented));
|
|
||||||
|
|
||||||
var secOcKeyProvisioningResult = await KmsProxy.KmsProxy.SecOCKey_SupplierKeyProvisioningResult(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeyProvisioning_Result
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(secOcKeyProvisioningResult, Formatting.Indented));
|
|
||||||
|
|
||||||
var secOcKeySync = await KmsProxy.KmsProxy.SecOCKey_SupplierKeySyncValue(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeySyncValue
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(secOcKeySync, Formatting.Indented));
|
|
||||||
|
|
||||||
var secOcKeySyncResult = await KmsProxy.KmsProxy.SecOCKey_SupplierKeySyncValueResult(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeySyncValue_Result
|
|
||||||
{
|
|
||||||
EcuID=""
|
|
||||||
});
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(secOcKeySyncResult, Formatting.Indented));
|
|
||||||
|
|
||||||
|
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
////global set
|
||||||
|
//string host = "192.168.0.43";
|
||||||
|
|
||||||
|
//Task.Run(async () =>
|
||||||
|
//{
|
||||||
|
// //1. ecuid
|
||||||
|
// var resEcuid = await KmsProxy.KmsProxy.EcuID_SupplierEcuID(host, new KmsProxy.Models.EcuID.Request_SupplierEcuID
|
||||||
|
// {
|
||||||
|
// EcuID = ""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(resEcuid, Formatting.Indented));
|
||||||
|
|
||||||
|
// //2. master ecu key
|
||||||
|
// var resMasterKeyProvisioning = await KmsProxy.KmsProxy.MasterEcuKey_SupplierKeyProvisioning(host, new KmsProxy.Models.MasterEcuKey.Request_SupplierKeyProvisioning
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(resMasterKeyProvisioning, Formatting.Indented));
|
||||||
|
|
||||||
|
// var resMasterKeyProvisioningResult = await KmsProxy.KmsProxy.MasterEcuKey_SupplierKeyProvisioningResult(host, new KmsProxy.Models.MasterEcuKey.Request_SupplierKeyProvisioning_Result
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(resMasterKeyProvisioningResult, Formatting.Indented));
|
||||||
|
|
||||||
|
// //3. SupplierSymmKey
|
||||||
|
// var symmKeyProvisioning = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeyProvisioning(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeyProvisioning
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(symmKeyProvisioning, Formatting.Indented));
|
||||||
|
|
||||||
|
// var symmKeyProvisioningResult = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeyProvisioningResult(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeyProvisioning_Result
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(symmKeyProvisioningResult, Formatting.Indented));
|
||||||
|
|
||||||
|
// var symmKeySync = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeySyncValue(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeySyncValue
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(symmKeySync, Formatting.Indented));
|
||||||
|
|
||||||
|
// var symmKeySyncResult = await KmsProxy.KmsProxy.SupplierSymmKey_SupplierKeySyncValueResult(host, new KmsProxy.Models.SupplierSymmKey.Request_SupplierKeySyncValue_Result
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(symmKeySyncResult, Formatting.Indented));
|
||||||
|
|
||||||
|
// //4. SecOCKey
|
||||||
|
// var secOcKeyProvisioning = await KmsProxy.KmsProxy.SecOCKey_SupplierKeyProvisioning(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeyProvisioning
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(secOcKeyProvisioning, Formatting.Indented));
|
||||||
|
|
||||||
|
// var secOcKeyProvisioningResult = await KmsProxy.KmsProxy.SecOCKey_SupplierKeyProvisioningResult(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeyProvisioning_Result
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(secOcKeyProvisioningResult, Formatting.Indented));
|
||||||
|
|
||||||
|
// var secOcKeySync = await KmsProxy.KmsProxy.SecOCKey_SupplierKeySyncValue(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeySyncValue
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(secOcKeySync, Formatting.Indented));
|
||||||
|
|
||||||
|
// var secOcKeySyncResult = await KmsProxy.KmsProxy.SecOCKey_SupplierKeySyncValueResult(host, new KmsProxy.Models.SecOCKey.Request_SupplierKeySyncValue_Result
|
||||||
|
// {
|
||||||
|
// EcuID=""
|
||||||
|
// });
|
||||||
|
// Console.WriteLine(JsonConvert.SerializeObject(secOcKeySyncResult, Formatting.Indented));
|
||||||
|
|
||||||
|
|
||||||
|
// }).Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
<RadzenPanelMenu>
|
<RadzenPanelMenu>
|
||||||
<RadzenPanelMenuItem Text="Home" Icon="home" Path="/"/>
|
<RadzenPanelMenuItem Text="Home" Icon="home" Path="/"/>
|
||||||
<RadzenPanelMenuItem Text="CPMeta" Icon="assignment" Path="/CpMeta"/>
|
<RadzenPanelMenuItem Text="CPMeta" Icon="assignment" Path="/CpMeta"/>
|
||||||
<RadzenPanelMenuItem Text="ProxyKms" Icon="assignment" Path="/ProxyKms"/>
|
@* <RadzenPanelMenuItem Text="ProxyKms" Icon="assignment" Path="/ProxyKms"/> *@
|
||||||
</RadzenPanelMenu>
|
</RadzenPanelMenu>
|
||||||
</RadzenSidebar>
|
</RadzenSidebar>
|
||||||
<RadzenBody Style="margin:0; padding:1rem; overflow:hidden; font-size: 2rem;">
|
<RadzenBody Style="margin:0; padding:1rem; overflow:hidden; font-size: 2rem;">
|
||||||
|
|||||||
Reference in New Issue
Block a user