CA-364330 wraps cyptoexception in try catch to show appropriate message (#2968)

Signed-off-by: Christophe25 <christopher.lancaste1@citrix.com>
This commit is contained in:
CitrixChris 2022-03-10 14:16:13 +00:00 committed by GitHub
parent ff76729940
commit f0f0de0076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,22 +222,23 @@ namespace XenAdmin.Actions
throw new Exception(Messages.UPDATE_CLIENT_INVALID_CHECKSUM );
}
bool valid;
bool valid = false;
try
{
// Check digital signature of .msi
using (var basicSigner = X509Certificate.CreateFromSignedFile(outputPathAndFileName))
{
using (var cert = new X509Certificate2(basicSigner))
{
try
{
valid = cert.Verify();
}
}
}
catch (Exception e)
{
throw new Exception(Messages.UPDATE_CLIENT_FAILED_CERTIFICATE_CHECK, e);
}
}
}
if (!valid)
throw new Exception(Messages.UPDATE_CLIENT_INVALID_DIGITAL_CERTIFICATE);