[성현모] NetStandard Dll 추가
This commit is contained in:
105
Projects/NetStandard/KmsProxy/KmsProxy.cs
Normal file
105
Projects/NetStandard/KmsProxy/KmsProxy.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using KmsProxy.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace KmsProxy
|
||||||
|
{
|
||||||
|
public class KmsProxy
|
||||||
|
{
|
||||||
|
public static int Port { get; set; } = 9200;
|
||||||
|
|
||||||
|
//1. EcuID
|
||||||
|
public static async Task<EcuID.Response_SupplierEcuID> EcuID_SupplierEcuID(string host, EcuID.Request_SupplierEcuID request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/ecuid/supplierEcuID";
|
||||||
|
|
||||||
|
var res = await RestAPI.PostAsync<EcuID.Request_SupplierEcuID, EcuID.Response_SupplierEcuID>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
//2. MasterECUKEy
|
||||||
|
public static async Task<MasterEcuKey.Response_SupplierKeyProvisioning> MasterEcuKey_SupplierKeyProvisioning(string host, MasterEcuKey.Request_SupplierKeyProvisioning request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/MasterEcuKey/SupplierKeyProvisioning";
|
||||||
|
|
||||||
|
var res = await RestAPI.PostAsync<MasterEcuKey.Request_SupplierKeyProvisioning, MasterEcuKey.Response_SupplierKeyProvisioning>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<MasterEcuKey.Response_SupplierKeyProvisioning_Result> MasterEcuKey_SupplierKeyProvisioningResult(string host, MasterEcuKey.Request_SupplierKeyProvisioning_Result request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/MasterEcuKey/SupplierKeyProvisioning";
|
||||||
|
|
||||||
|
var res = await RestAPI.PutAsync<MasterEcuKey.Request_SupplierKeyProvisioning_Result, MasterEcuKey.Response_SupplierKeyProvisioning_Result>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
//3. SupplierSymmKey
|
||||||
|
public static async Task<SupplierSymmKey.Response_SupplierKeyProvisioning> SupplierSymmKey_SupplierKeyProvisioning(string host, SupplierSymmKey.Request_SupplierKeyProvisioning request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SupplierSymmKey/SupplierKeyProvisioning";
|
||||||
|
|
||||||
|
var res = await RestAPI.PostAsync<SupplierSymmKey.Request_SupplierKeyProvisioning, SupplierSymmKey.Response_SupplierKeyProvisioning>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<SupplierSymmKey.Response_SupplierKeyProvisioning_Result> SupplierSymmKey_SupplierKeyProvisioningResult(string host, SupplierSymmKey.Request_SupplierKeyProvisioning_Result request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SupplierSymmKey/SupplierKeyProvisioning";
|
||||||
|
|
||||||
|
var res = await RestAPI.PutAsync<SupplierSymmKey.Request_SupplierKeyProvisioning_Result, SupplierSymmKey.Response_SupplierKeyProvisioning_Result>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<SupplierSymmKey.Response_SupplierKeySyncValue> SupplierSymmKey_SupplierKeySyncValue(string host, SupplierSymmKey.Request_SupplierKeySyncValue request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SupplierSymmKey/SupplierKeySyncValue";
|
||||||
|
|
||||||
|
var res = await RestAPI.PostAsync<SupplierSymmKey.Request_SupplierKeySyncValue, SupplierSymmKey.Response_SupplierKeySyncValue>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<SupplierSymmKey.Response_SupplierKeySyncValue_Result> SupplierSymmKey_SupplierKeySyncValueResult(string host, SupplierSymmKey.Request_SupplierKeySyncValue_Result request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SupplierSymmKey/SupplierKeySyncValue";
|
||||||
|
|
||||||
|
var res = await RestAPI.PutAsync<SupplierSymmKey.Request_SupplierKeySyncValue_Result, SupplierSymmKey.Response_SupplierKeySyncValue_Result>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
//4.SecOCKey
|
||||||
|
public static async Task<SecOCKey.Response_SupplierKeyProvisioning> SecOCKey_SupplierKeyProvisioning(string host, SecOCKey.Request_SupplierKeyProvisioning request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SecOCKey/SupplierKeyProvisioning";
|
||||||
|
|
||||||
|
var res = await RestAPI.PostAsync<SecOCKey.Request_SupplierKeyProvisioning, SecOCKey.Response_SupplierKeyProvisioning>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<SecOCKey.Response_SupplierKeyProvisioning_Result> SecOCKey_SupplierKeyProvisioningResult(string host, SecOCKey.Request_SupplierKeyProvisioning_Result request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SecOCKey/SupplierKeyProvisioning";
|
||||||
|
|
||||||
|
var res = await RestAPI.PutAsync<SecOCKey.Request_SupplierKeyProvisioning_Result, SecOCKey.Response_SupplierKeyProvisioning_Result>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<SecOCKey.Response_SupplierKeySyncValue> SecOCKey_SupplierKeySyncValue(string host, SecOCKey.Request_SupplierKeySyncValue request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SecOCKey/SupplierKeySyncValue";
|
||||||
|
|
||||||
|
var res = await RestAPI.PostAsync<SecOCKey.Request_SupplierKeySyncValue, SecOCKey.Response_SupplierKeySyncValue>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<SecOCKey.Response_SupplierKeySyncValue_Result> SecOCKey_SupplierKeySyncValueResult(string host, SecOCKey.Request_SupplierKeySyncValue_Result request)
|
||||||
|
{
|
||||||
|
string url = $"https://{host}:{Port}/kms/SecOCKey/SupplierKeySyncValue";
|
||||||
|
|
||||||
|
var res = await RestAPI.PutAsync<SecOCKey.Request_SupplierKeySyncValue_Result, SecOCKey.Response_SupplierKeySyncValue_Result>(url, request);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Projects/NetStandard/KmsProxy/KmsProxy.csproj
Normal file
11
Projects/NetStandard/KmsProxy/KmsProxy.csproj
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
217
Projects/NetStandard/KmsProxy/Models/Packet.cs
Normal file
217
Projects/NetStandard/KmsProxy/Models/Packet.cs
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KmsProxy.Models
|
||||||
|
{
|
||||||
|
//1. EcuID
|
||||||
|
public class EcuID
|
||||||
|
{
|
||||||
|
public class Request_SupplierEcuID
|
||||||
|
{
|
||||||
|
public string EcuType { get; set; } = string.Empty;
|
||||||
|
public string Phase { get; set; } = string.Empty;
|
||||||
|
public string SupplierID { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string Serial { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Response_SupplierEcuID : Response_Common
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//2. MasterECUKey
|
||||||
|
public class MasterEcuKey
|
||||||
|
{
|
||||||
|
public class Request_SupplierKeyProvisioning
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeyProvisioning : Response_Common
|
||||||
|
{
|
||||||
|
public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
|
||||||
|
|
||||||
|
#region record
|
||||||
|
public class SupplierKeyProvisioningRecords
|
||||||
|
{
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
public string M1 { get; set; } = string.Empty;
|
||||||
|
public string M2 { get; set; } = string.Empty;
|
||||||
|
public string M3 { get; set; } = string.Empty;
|
||||||
|
public string M4 { get; set; } = string.Empty;
|
||||||
|
public string M5 { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public class Request_SupplierKeyProvisioning_Result
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string ResultMessage { get; set; } = string.Empty;
|
||||||
|
public string ResultStatus { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeyProvisioning_Result : Response_Common
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//3. SupplierSymmKey
|
||||||
|
public class SupplierSymmKey
|
||||||
|
{
|
||||||
|
public class Request_SupplierKeyProvisioning
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeyProvisioning : Response_Common
|
||||||
|
{
|
||||||
|
public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
|
||||||
|
|
||||||
|
#region record
|
||||||
|
public class SupplierKeyProvisioningRecords
|
||||||
|
{
|
||||||
|
public string M1 { get; set; } = string.Empty;
|
||||||
|
public string M2 { get; set; } = string.Empty;
|
||||||
|
public string M3 { get; set; } = string.Empty;
|
||||||
|
public string M4 { get; set; } = string.Empty;
|
||||||
|
public string M5 { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public class Request_SupplierKeyProvisioning_Result
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string ResultMessage { get; set; } = string.Empty;
|
||||||
|
public string ResultStatus { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeyProvisioning_Result : Response_Common
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public class Request_SupplierKeySyncValue
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeySyncValue : Response_Common
|
||||||
|
{
|
||||||
|
public List<SupplierKeySyncValueRecords> Records { get; set; } = new List<SupplierKeySyncValueRecords>();
|
||||||
|
|
||||||
|
#region record
|
||||||
|
public class SupplierKeySyncValueRecords
|
||||||
|
{
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
public string KeySyncValue { get; set; } = string.Empty;
|
||||||
|
public string Challenge { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public class Request_SupplierKeySyncValue_Result
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string ResultMessage { get; set; } = string.Empty;
|
||||||
|
public string ResultStatus { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeySyncValue_Result : Response_Common
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//4. SecOCKey
|
||||||
|
public class SecOCKey
|
||||||
|
{
|
||||||
|
public class Request_SupplierKeyProvisioning
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
public string SupplierSecretKey { get; set; } = string.Empty;
|
||||||
|
public string Counter { get; set; } = string.Empty;
|
||||||
|
public string Challenge { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeyProvisioning : Response_Common
|
||||||
|
{
|
||||||
|
public List<SupplierKeyProvisioningRecords> Records { get; set; } = new List<SupplierKeyProvisioningRecords>();
|
||||||
|
|
||||||
|
#region record
|
||||||
|
public class SupplierKeyProvisioningRecords
|
||||||
|
{
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
public string M1 { get; set; } = string.Empty;
|
||||||
|
public string M2 { get; set; } = string.Empty;
|
||||||
|
public string M3 { get; set; } = string.Empty;
|
||||||
|
public string M4 { get; set; } = string.Empty;
|
||||||
|
public string M5 { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public class Request_SupplierKeyProvisioning_Result
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
public string ResultMessage { get; set; } = string.Empty;
|
||||||
|
public string ResultStatus { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeyProvisioning_Result : Response_Common
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public class Request_SupplierKeySyncValue
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeySyncValue : Response_Common
|
||||||
|
{
|
||||||
|
public List<SupplierKeySyncValueRecords> Records { get; set; } = new List<SupplierKeySyncValueRecords>();
|
||||||
|
|
||||||
|
#region record
|
||||||
|
public class SupplierKeySyncValueRecords
|
||||||
|
{
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
public string KeySyncValue { get; set; } = string.Empty;
|
||||||
|
public string Challenge { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public class Request_SupplierKeySyncValue_Result
|
||||||
|
{
|
||||||
|
public string ProvisioningType { get; set; } = string.Empty;
|
||||||
|
public string EcuID { get; set; } = string.Empty;
|
||||||
|
public string KeyID { get; set; } = string.Empty;
|
||||||
|
public string ResultMessage { get; set; } = string.Empty;
|
||||||
|
public string ResultStatus { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
public class Response_SupplierKeySyncValue_Result : Response_Common
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region common
|
||||||
|
public class Response_Common
|
||||||
|
{
|
||||||
|
public string ResultStatus { get; set; } = string.Empty;
|
||||||
|
public string ResultReason { get; set; } = string.Empty;
|
||||||
|
public string ResultMessage { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
92
Projects/NetStandard/KmsProxy/RestAPI.cs
Normal file
92
Projects/NetStandard/KmsProxy/RestAPI.cs
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace KmsProxy
|
||||||
|
{
|
||||||
|
public class RestAPI
|
||||||
|
{
|
||||||
|
private static HttpClient RequestClient = new HttpClient();
|
||||||
|
private static HttpClient ResponseClient = new HttpClient();
|
||||||
|
|
||||||
|
static RestAPI()
|
||||||
|
{
|
||||||
|
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
|
||||||
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||||
|
RequestClient.Timeout = TimeSpan.FromMilliseconds(10000);
|
||||||
|
ResponseClient.Timeout = TimeSpan.FromMilliseconds(10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<RESPONSE> PostAsync<REQUEST, RESPONSE>(string Url, REQUEST body) where REQUEST : class where RESPONSE : class
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (body != null)
|
||||||
|
{
|
||||||
|
var jsonBody = JsonConvert.SerializeObject(body);
|
||||||
|
var contents = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
var response = await RequestClient.PostAsync(Url, contents);
|
||||||
|
|
||||||
|
var resContentStr = await response.Content.ReadAsStringAsync();
|
||||||
|
return JsonConvert.DeserializeObject<RESPONSE>(resContentStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("PostAsync Error");
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return default(RESPONSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<RESPONSE> GetAsync<RESPONSE>(string Url)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await ResponseClient.GetAsync(Url);
|
||||||
|
|
||||||
|
var resContentStr = await response.Content.ReadAsStringAsync();
|
||||||
|
return JsonConvert.DeserializeObject<RESPONSE>(resContentStr);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("GetAsync Error");
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return default(RESPONSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<RESPONSE> PutAsync<REQUEST, RESPONSE>(string Url, REQUEST body) where REQUEST : class where RESPONSE : class
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (body != null)
|
||||||
|
{
|
||||||
|
var jsonBody = JsonConvert.SerializeObject(body);
|
||||||
|
var contents = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
var response = await RequestClient.PutAsync(Url, contents);
|
||||||
|
|
||||||
|
var resContentStr = await response.Content.ReadAsStringAsync();
|
||||||
|
return JsonConvert.DeserializeObject<RESPONSE>(resContentStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("PostAsync Error");
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return default(RESPONSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayGround.NetFramework", "
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CIAMaster", "CIAMaster\CIAMaster.csproj", "{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CIAMaster", "CIAMaster\CIAMaster.csproj", "{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KmsProxy", "KmsProxy\KmsProxy.csproj", "{73824ACB-4FB9-4E11-9A86-E05471B3C979}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -27,6 +29,10 @@ Global
|
|||||||
{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E839065B-EB9C-4ADE-93D1-EFE3B03A977F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{73824ACB-4FB9-4E11-9A86-E05471B3C979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{73824ACB-4FB9-4E11-9A86-E05471B3C979}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{73824ACB-4FB9-4E11-9A86-E05471B3C979}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{73824ACB-4FB9-4E11-9A86-E05471B3C979}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -56,5 +56,11 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\KmsProxy\KmsProxy.csproj">
|
||||||
|
<Project>{73824acb-4fb9-4e11-9a86-e05471b3c979}</Project>
|
||||||
|
<Name>KmsProxy</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using CPMeta.Models;
|
using CPMeta.Models;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -9,33 +10,81 @@ namespace PlayGround.NetFramework
|
|||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//global set
|
//global set
|
||||||
string host = "192.168.0.126";
|
string host = "192.168.0.43";
|
||||||
|
|
||||||
//random value
|
|
||||||
string ProductId = Guid.NewGuid().ToString();
|
|
||||||
string Mac1 = Guid.NewGuid().ToString();
|
|
||||||
string Mac2 = Guid.NewGuid().ToString();
|
|
||||||
|
|
||||||
//Set
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
Request_SetWbmsMeta req = new Request_SetWbmsMeta();
|
//1. ecuid
|
||||||
req.ProductID = ProductId;
|
var resEcuid = await KmsProxy.KmsProxy.EcuID_SupplierEcuID(host, new KmsProxy.Models.EcuID.Request_SupplierEcuID
|
||||||
req.MacAddress1 = Mac1;
|
|
||||||
req.MacAddress2 = Mac2;
|
|
||||||
req.ProductNo = "ProductNo";
|
|
||||||
req.Type = "CMU";
|
|
||||||
|
|
||||||
var res = await CPMeta.CPMeta.SetWbmsMetaAsync(host, req);
|
|
||||||
|
|
||||||
}).Wait();
|
|
||||||
|
|
||||||
//Get
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
{
|
||||||
var res2 = await CPMeta.CPMeta.GetWbmsMetaByProductId(host, ProductId);
|
EcuID = ""
|
||||||
var res3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress(host, Mac1);
|
});
|
||||||
var res4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress(host, Mac2);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user