public static void BindCertificateToIpAndPort(X509Certificate2 cert, string url)
        {
            var uri      = new Uri(url);
            var certInfo = HttpApiSslCert.QuerySslCertificateInfo(new IPEndPoint(0, uri.Port));

            if (certInfo != null)
            {
                HttpApiSslCert.DeleteCertificateBinding(new[] { new IPEndPoint(0, uri.Port) });
            }
            HttpApiSslCert.BindCertificate(new IPEndPoint(0, uri.Port), cert.GetCertHash(), StoreName.My, new Guid(APP_ID));
        }
        public static bool CertificateBoundToIpAndPort(string url, byte[] certHash)
        {
            var uri      = new Uri(url);
            var certInfo = HttpApiSslCert.QuerySslCertificateInfo(new IPEndPoint(0, uri.Port));

            if (certInfo == null)
            {
                return(false);
            }

            return(certInfo.Hash.SequenceEqual(certHash));
        }