public static int GetCertificateState(string xml) { WebClient wc = new WebClient(); byte[] bytes = wc.DownloadData(caCertUrl); BIO bio = new BIO(bytes); X509Certificate certca = X509Certificate.FromDER(bio); XMLClass xmlEx = new XMLClass(); byte[] bytesCert = UTF8Encoding.UTF8.GetBytes(xml); string sCert = xmlEx.getX509FromXMLbytes(bytesCert); BIO bCert = new BIO(Convert.FromBase64String(sCert)); X509Certificate cert = X509Certificate.FromDER(bCert); int result = cert.CheckOCSP(certca, ocspUrl); return(result); }