mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
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:
parent
ff76729940
commit
f0f0de0076
@ -222,22 +222,23 @@ namespace XenAdmin.Actions
|
|||||||
throw new Exception(Messages.UPDATE_CLIENT_INVALID_CHECKSUM );
|
throw new Exception(Messages.UPDATE_CLIENT_INVALID_CHECKSUM );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool valid;
|
bool valid = false;
|
||||||
// Check digital signature of .msi
|
try
|
||||||
using (var basicSigner = X509Certificate.CreateFromSignedFile(outputPathAndFileName))
|
|
||||||
{
|
{
|
||||||
using (var cert = new X509Certificate2(basicSigner))
|
// Check digital signature of .msi
|
||||||
|
using (var basicSigner = X509Certificate.CreateFromSignedFile(outputPathAndFileName))
|
||||||
{
|
{
|
||||||
try
|
using (var cert = new X509Certificate2(basicSigner))
|
||||||
{
|
{
|
||||||
valid = cert.Verify();
|
valid = cert.Verify();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new Exception(Messages.UPDATE_CLIENT_FAILED_CERTIFICATE_CHECK, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new Exception(Messages.UPDATE_CLIENT_FAILED_CERTIFICATE_CHECK, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!valid)
|
if (!valid)
|
||||||
throw new Exception(Messages.UPDATE_CLIENT_INVALID_DIGITAL_CERTIFICATE);
|
throw new Exception(Messages.UPDATE_CLIENT_INVALID_DIGITAL_CERTIFICATE);
|
||||||
|
Loading…
Reference in New Issue
Block a user