Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
thohng committed Jan 14, 2024
1 parent 8c310f9 commit a307e8f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions EchoServiceApi/Verifiers/CertificateVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ public Task<VerifyResult> VerifyAsync(string name, bool privateKey)
{
var connectionObj = GetConnection(name);

var certificateConfig = connectionObj.Get<CertificateConfig>() ?? throw new ArgumentNullException("connection name not found");
var certificateConfig = connectionObj.Get<CertificateConfig>() ?? throw new Exception("connection name not found");
var cert = CertificateLoader.LoadCertificate(certificateConfig, "certificate", null, privateKey);
// var cert = new X509Certificate2(certificateConfig.Path ?? throw new ArgumentNullException(), certificateConfig.Password, X509KeyStorageFlags.DefaultKeySet);
// var cert = new X509Certificate2(certificateConfig.Path ?? throw new ArgumentNullException(), certificateConfig.Password, X509KeyStorageFlags.DefaultKeySet)

try
{
var result = new List<string>();
if (cert != null)
{
string format(X509Certificate2 cert)
static string format(X509Certificate2 cert)
{
return $"{FormatCert(cert, cert.HasPrivateKey)}";
}
Expand Down

0 comments on commit a307e8f

Please sign in to comment.