/// <summary> /// Checks if the certificate is valid /// </summary> /// <param name="certificate">The certificate to check</param> /// <returns>boolean stating whether the certificate is valid (true) or not (false)</returns> /// <exception cref="CheckCertificateValidUnexpectedException">This exception is thrown, if an unexpected exception is thrown during the method</exception> public bool CheckCertificateValidation(X509Certificate2 certificate) { bool isValid = false; try { CertificateValidator.CheckCertificateExpired(certificate); isValid = true; } catch (CertificateExpiredException) { isValid = false; } catch (ArgumentNullException) { throw; } catch (CryptographicUnexpectedOperationException) { throw; } catch (CryptographicException) { throw; } catch (Exception e) { throw new CheckCertificateValidUnexpectedException(e); } return(isValid); }