[성현모] VPKI 자동 테스트 기능 추가
This commit is contained in:
@ -218,7 +218,7 @@ namespace VPKI.Web.Api.Services
|
|||||||
//db처리
|
//db처리
|
||||||
using (var transaction = await context.CreateTransactionAsync())
|
using (var transaction = await context.CreateTransactionAsync())
|
||||||
{
|
{
|
||||||
if (await context.TCertificates.AsNoTracking().FirstOrDefaultAsync(x => x.CCuid == tbscsr.CCuid) != null)
|
if (await context.TCertificates.AsNoTracking().FirstOrDefaultAsync(x => x.CCuid == tbscsr.CCuid) == null)
|
||||||
{
|
{
|
||||||
var certificate = new TCertificate
|
var certificate = new TCertificate
|
||||||
{
|
{
|
||||||
@ -245,7 +245,7 @@ namespace VPKI.Web.Api.Services
|
|||||||
var ocsp = await Ocsp(tbscsr.CCuid);
|
var ocsp = await Ocsp(tbscsr.CCuid);
|
||||||
using (var transaction = await context.CreateTransactionAsync())
|
using (var transaction = await context.CreateTransactionAsync())
|
||||||
{
|
{
|
||||||
if (await context.TOcsps.AsNoTracking().FirstOrDefaultAsync(x => x.CCuid == tbscsr.CCuid) != null)
|
if (await context.TOcsps.AsNoTracking().FirstOrDefaultAsync(x => x.CCuid == tbscsr.CCuid) == null)
|
||||||
{
|
{
|
||||||
var certificate = new TOcsp
|
var certificate = new TOcsp
|
||||||
{
|
{
|
||||||
|
|||||||
@ -228,7 +228,7 @@ namespace VPKI.Web.Api.Services
|
|||||||
|
|
||||||
using (var transaction = await context.CreateTransactionAsync())
|
using (var transaction = await context.CreateTransactionAsync())
|
||||||
{
|
{
|
||||||
if (await context.TCertificates.AsNoTracking().FirstOrDefaultAsync(x => x.CCuid == tbscsr.CCuid) != null)
|
if (await context.TCertificates.AsNoTracking().FirstOrDefaultAsync(x => x.CCuid == tbscsr.CCuid) == null)
|
||||||
{
|
{
|
||||||
var certificate = new TCertificate
|
var certificate = new TCertificate
|
||||||
{
|
{
|
||||||
|
|||||||
@ -112,7 +112,7 @@
|
|||||||
CreateCsrHash(ecdsa);
|
CreateCsrHash(ecdsa);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClickSignedHash()
|
public void OnClickSignedHash()
|
||||||
{
|
{
|
||||||
SignedHash();
|
SignedHash();
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClickGenerateCertificate()
|
public void OnClickGenerateCertificate()
|
||||||
{
|
{
|
||||||
CertificateContainer.RequestCertificate.csrsignature = CertificateContainer.CsrHashed.EncodedSignedCsr;
|
CertificateContainer.RequestCertificate.csrsignature = CertificateContainer.CsrHashed.EncodedSignedCsr;
|
||||||
if (TbscsrContainer.VpkiType == VpkiType.prov_cert || TbscsrContainer.VpkiType == VpkiType.vehicle_cert)
|
if (TbscsrContainer.VpkiType == VpkiType.prov_cert || TbscsrContainer.VpkiType == VpkiType.vehicle_cert)
|
||||||
@ -171,7 +171,7 @@
|
|||||||
CertificateContainer.StrRequest = $"{CertificateContainer.RequestCertificate.ToJson()}";
|
CertificateContainer.StrRequest = $"{CertificateContainer.RequestCertificate.ToJson()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnClickSendCertificate()
|
public async Task OnClickSendCertificate()
|
||||||
{
|
{
|
||||||
DialogService.OpenIndicator();
|
DialogService.OpenIndicator();
|
||||||
|
|
||||||
|
|||||||
@ -111,7 +111,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//mac address
|
//mac address
|
||||||
private void OnClickRandomMacaddresss()
|
public void OnClickRandomMacaddresss()
|
||||||
{
|
{
|
||||||
var randomMac = CreateRandomMacAddress();
|
var randomMac = CreateRandomMacAddress();
|
||||||
TbscsrContainer.RequestTbscsr.cnInfo.macaddr = randomMac;
|
TbscsrContainer.RequestTbscsr.cnInfo.macaddr = randomMac;
|
||||||
@ -126,7 +126,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//generate key
|
//generate key
|
||||||
private void OnClickGenerateKey()
|
public void OnClickGenerateKey()
|
||||||
{
|
{
|
||||||
GenerateKey();
|
GenerateKey();
|
||||||
}
|
}
|
||||||
@ -169,13 +169,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//request tbscsr
|
//request tbscsr
|
||||||
private void OnClickGenerateTbscsr()
|
public void OnClickGenerateTbscsr()
|
||||||
{
|
{
|
||||||
TbscsrContainer.RequestTbscsr.publickey = TbscsrContainer.PublicKey;
|
TbscsrContainer.RequestTbscsr.publickey = TbscsrContainer.PublicKey;
|
||||||
TbscsrContainer.StrRequest = $"{TbscsrContainer.RequestTbscsr.ToJson()}";
|
TbscsrContainer.StrRequest = $"{TbscsrContainer.RequestTbscsr.ToJson()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnClickSendTbscsr()
|
public async Task OnClickSendTbscsr()
|
||||||
{
|
{
|
||||||
DialogService.OpenIndicator();
|
DialogService.OpenIndicator();
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,9 @@
|
|||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<RadzenLabel Style="width: 130px;" Text="Server Address"></RadzenLabel>
|
<RadzenLabel Style="width: 130px;" Text="Server Address"></RadzenLabel>
|
||||||
<RadzenTextBox Style="margin-right: 10px;" @bind-Value="@ServerAddress"></RadzenTextBox>
|
<RadzenTextBox Style="margin-right: 10px;" @bind-Value="@ServerAddress"></RadzenTextBox>
|
||||||
|
|
||||||
|
<RadzenLabel Style="width: 130px;" Text="Auto Test"></RadzenLabel>
|
||||||
|
<RadzenCheckBox Style="margin-right: 10px;" @bind-Value="@isAutoRun"></RadzenCheckBox>
|
||||||
</div>
|
</div>
|
||||||
</RadzenFieldset>
|
</RadzenFieldset>
|
||||||
|
|
||||||
@ -28,12 +31,12 @@
|
|||||||
<RadzenTabsItem Text="@vpkiType.ToString()">
|
<RadzenTabsItem Text="@vpkiType.ToString()">
|
||||||
<div @key=@vpkiType>
|
<div @key=@vpkiType>
|
||||||
<!--CSR-->
|
<!--CSR-->
|
||||||
<VPKIApiTbscsr @bind-TbscsrContainer=@outTbscsr ServerAddress="@ServerAddress"
|
<VPKIApiTbscsr @ref="@refVPKIApiTbscsr" @bind-TbscsrContainer=@outTbscsr ServerAddress="@ServerAddress"
|
||||||
TbscsrCallback="@TbscsrCallback"/>
|
TbscsrCallback="@TbscsrCallback"/>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<!--certificate-->
|
<!--certificate-->
|
||||||
<VPKIApiCertificate @bind-CertificateContainer=@outCertificate ServerAddress="@ServerAddress" TbscsrContainer="@outTbscsr" />
|
<VPKIApiCertificate @ref="@refVPKIApiCertificate" @bind-CertificateContainer=@outCertificate ServerAddress="@ServerAddress" TbscsrContainer="@outTbscsr" />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<!--certificate-->
|
<!--certificate-->
|
||||||
@ -50,16 +53,54 @@
|
|||||||
<RadzenLabel Text="Not Authorized"></RadzenLabel>
|
<RadzenLabel Text="Not Authorized"></RadzenLabel>
|
||||||
</NotAuthorized>
|
</NotAuthorized>
|
||||||
</AuthorizeView>
|
</AuthorizeView>
|
||||||
@code {
|
@code {
|
||||||
private string ServerAddress = "127.0.0.1:8080";
|
private string ServerAddress = "127.0.0.1:8080";
|
||||||
|
private bool isAutoRun = false;
|
||||||
|
|
||||||
Dictionary<VpkiType, TbscsrContainer> DicTbscsrContainer = new Dictionary<VpkiType, TbscsrContainer>();
|
Dictionary<VpkiType, TbscsrContainer> DicTbscsrContainer = new Dictionary<VpkiType, TbscsrContainer>();
|
||||||
Dictionary<VpkiType, CertificateContainer> DicCertificateContainer = new Dictionary<VpkiType, CertificateContainer>();
|
Dictionary<VpkiType, CertificateContainer> DicCertificateContainer = new Dictionary<VpkiType, CertificateContainer>();
|
||||||
Dictionary<VpkiType, VerifyResultContainer> DicVerifyResultContainer = new Dictionary<VpkiType, VerifyResultContainer>();
|
Dictionary<VpkiType, VerifyResultContainer> DicVerifyResultContainer = new Dictionary<VpkiType, VerifyResultContainer>();
|
||||||
|
|
||||||
|
VPKIApiTbscsr? refVPKIApiTbscsr;
|
||||||
|
VPKIApiCertificate? refVPKIApiCertificate;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
|
int cnt = 0;
|
||||||
SetDefaultValue();
|
SetDefaultValue();
|
||||||
|
Task.Run(async() => {
|
||||||
|
await Task.Delay(3000);
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
//tbscsr
|
||||||
|
await Task.Delay(3000);
|
||||||
|
|
||||||
|
if (isAutoRun == false)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
await InvokeAsync(() => refVPKIApiTbscsr.OnClickRandomMacaddresss());
|
||||||
|
await Task.Delay(100);
|
||||||
|
await InvokeAsync(() => refVPKIApiTbscsr.OnClickGenerateKey());
|
||||||
|
await Task.Delay(100);
|
||||||
|
await InvokeAsync(() => refVPKIApiTbscsr.OnClickGenerateTbscsr());
|
||||||
|
await Task.Delay(100);
|
||||||
|
await InvokeAsync(async () => await refVPKIApiTbscsr.OnClickSendTbscsr());
|
||||||
|
await Task.Delay(100);
|
||||||
|
|
||||||
|
//certificate
|
||||||
|
await InvokeAsync(() => refVPKIApiCertificate.OnClickSignedHash());
|
||||||
|
await Task.Delay(100);
|
||||||
|
await InvokeAsync(() => refVPKIApiCertificate.OnClickGenerateCertificate());
|
||||||
|
await Task.Delay(100);
|
||||||
|
await InvokeAsync(async () => await refVPKIApiCertificate.OnClickSendCertificate());
|
||||||
|
|
||||||
|
cnt += 1;
|
||||||
|
if (cnt >= 10000)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDefaultValue()
|
private void SetDefaultValue()
|
||||||
|
|||||||
@ -199,25 +199,25 @@
|
|||||||
//Default filter
|
//Default filter
|
||||||
requestUrl += $"startDate={SearchStartDate}&";
|
requestUrl += $"startDate={SearchStartDate}&";
|
||||||
requestUrl += $"endDate={SearchEndDate}&";
|
requestUrl += $"endDate={SearchEndDate}&";
|
||||||
requestUrl += $"startCcuid={startCcuid}&";
|
// requestUrl += $"startCcuid={startCcuid}&";
|
||||||
|
|
||||||
//optional filter
|
//optional filter
|
||||||
if (string.IsNullOrEmpty(FilterIft) == false)
|
// if (string.IsNullOrEmpty(FilterIft) == false)
|
||||||
{
|
// {
|
||||||
requestUrl += $"ift={FilterIft}&";
|
// requestUrl += $"ift={FilterIft}&";
|
||||||
}
|
// }
|
||||||
if (string.IsNullOrEmpty(FilterWMI) == false)
|
// if (string.IsNullOrEmpty(FilterWMI) == false)
|
||||||
{
|
// {
|
||||||
requestUrl += $"wmi={FilterWMI}&";
|
// requestUrl += $"wmi={FilterWMI}&";
|
||||||
}
|
// }
|
||||||
if (string.IsNullOrEmpty(FilterDC) == false)
|
// if (string.IsNullOrEmpty(FilterDC) == false)
|
||||||
{
|
// {
|
||||||
requestUrl += $"dc={FilterDC}&";
|
// requestUrl += $"dc={FilterDC}&";
|
||||||
}
|
// }
|
||||||
if (string.IsNullOrEmpty(FilterCertType) == false)
|
// if (string.IsNullOrEmpty(FilterCertType) == false)
|
||||||
{
|
// {
|
||||||
requestUrl += $"certType={FilterCertType}&";
|
// requestUrl += $"certType={FilterCertType}&";
|
||||||
}
|
// }
|
||||||
|
|
||||||
history?.Clear();
|
history?.Clear();
|
||||||
var result = await ApiService.GetJsonAsync<List<CertificateHistoryModel>>(requestUrl);
|
var result = await ApiService.GetJsonAsync<List<CertificateHistoryModel>>(requestUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user