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