public GfipmCryptoTrustFabric()
        {
            // Open embedded Trust Fabric document
            XmlDocument trustFabricXmlDoc = GetTrustFabricXmlDocument();
 
            _gfipmEntities = CtfSerializer.Deserialize<EntitiesDescriptorType>(trustFabricXmlDoc.InnerXml, 
                "EntitiesDescriptor", "urn:oasis:names:tc:SAML:2.0:metadata") as EntitiesDescriptorType;
        }
        private void ctfPath_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string url = ctfPath.Text;

                try
                {
                    HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url);
                    httpRequest.UserAgent = @"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";

                    using (HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse())
                    {
                        XmlDocument xmlDocument = new XmlDocument();
                        xmlDocument.PreserveWhitespace = true;

                        xmlDocument.Load(httpResponse.GetResponseStream());

                        GfipmCryptoTrustFabric.GfipmCryptoTrustFabric tf = new GfipmCryptoTrustFabric.GfipmCryptoTrustFabric();

                        _entitiesDescriptor = tf.LoadFromXml(xmlDocument.OuterXml);

                        Reload();
                    }
                }
                catch (Exception ex)
                {
                    string msg = string.Format("Error: {0}. {1}",
                        ex.Message, (ex.InnerException != null) ? ex.InnerException.Message : "");
                    System.Windows.Forms.MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void browseButton_Click(object sender, EventArgs e)
        {
            if (this.CryptographicTrustFabricFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.ctfPath.Text = CryptographicTrustFabricFileDialog.FileName;

                GfipmCryptoTrustFabric.GfipmCryptoTrustFabric tf = new GfipmCryptoTrustFabric.GfipmCryptoTrustFabric();

                try
                {
                    _entitiesDescriptor = tf.OpenCtfFileAndValidateSignature(this.ctfPath.Text);
         
                    Reload();
                }
                catch (Exception ex)
                {
                    string msg = string.Format("Error: {0}. {1}",
                        ex.Message, (ex.InnerException != null) ? ex.InnerException.Message : "");
                    System.Windows.Forms.MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
 public GfipmCryptoTrustFabric(string ctfPath)
 {
     _gfipmEntities = OpenCtfFile(ctfPath);
 }