private void VerifyCertificate(X509Certificate2 certificate)
{
try
{
m_certificateValidator.Validate(certificate);
}
catch (Exception e)
{
// construct translation object with default text.
TranslationInfo info = new TranslationInfo(
"InvalidCertificate",
"en-US",
"'{0}' is not a trusted user certificate.",
certificate.Subject);
// create an exception with a vendor defined sub-code.
throw new ServiceResultException(new ServiceResult(
e,
StatusCodes.BadIdentityTokenRejected,
"InvalidCertificate",
"http://opcfoundation.org/UA/Sample/",
new LocalizedText(info)));
}
}