private void button1_Click(object sender, EventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { this.tbCerPath.Text = openFileDialog1.FileName; X509Certificate2 cer = CryptUtils.getPublicKeyXmlFromCer(openFileDialog1.FileName); XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(cer.PublicKey.Key.ToXmlString(false)); XmlNode node = xmldoc.SelectNodes("//Modulus")[0]; this.tbPublicN.Text = CryptUtils.hex2asc(CryptUtils.Base64Decoder(node.FirstChild.Value)); } }