private void Button1_Click(object sender, EventArgs e) { try { var tuple = NbeXmlDocumentSigner.SignBodyParameter(textBox1.Text, NbeXmlDocumentSigner.GetPrivateKeyFromPath(textBox3.Text, textBox4.Text)); textBox2.Text = tuple.signedEnvelope; } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void Button5_Click(object sender, EventArgs e) { try { var signed = NbeXmlDocumentSigner.SignBody(textBox1.Text, NbeXmlDocumentSigner.GetPrivateKeyFromPath(textBox3.Text, textBox4.Text)); textBox2.Text = signed; } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void Button3_Click(object sender, EventArgs e) { try { var doc = new XmlDocument(); doc.LoadXml(textBox2.Text); var xmlElement = doc.GetElementsByTagName("xml")[0]; var decodedSignature = HttpUtility.HtmlDecode(xmlElement.InnerText); //string path = @"D:\Projects\NBE-Dev\AltaSoft.Nbe.Processor\bin\Debug\publickey.cer"; //string path = @"C:\Users\d.dvali\Desktop\certnew.p7b"; //string path = textBox5.Text; var doc2 = new XmlDocument(); doc2.LoadXml(decodedSignature); if (!checkBox1.Checked) { if (NbeXmlDocumentSigner.ValidateSignature(doc2, NbeXmlDocumentSigner.GetPublicKeyFromPath(textBox5.Text))) { MessageBox.Show("CheckedSignature Successful"); } else { MessageBox.Show("CheckedSignature not Successful"); } } else { if (NbeXmlDocumentSigner.ValidateSignature(doc2, NbeXmlDocumentSigner.GetPrivateKeyFromPath(textBox3.Text, textBox4.Text)) ) //()))//.GetPrivateKeyFromPath(@"C:\Users\d.dvali\Desktop\Aa123456 tsttbcnbe.tbcbank.ge.pfx", "1")))//(@"C:\Users\d.dvali\Desktop\certnew.p7b"))) { MessageBox.Show("CheckedSignature Successful"); } else { MessageBox.Show("CheckedSignature not Successful"); } } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void Button6_Click(object sender, EventArgs e) { try { var doc = new XmlDocument(); doc.LoadXml(textBox2.Text); if (!checkBox1.Checked) { if (NbeXmlDocumentSigner.ValidateSignature(doc, NbeXmlDocumentSigner.GetPublicKeyFromPath(textBox5.Text))) { MessageBox.Show("CheckedSignature Successful"); } else { MessageBox.Show("CheckedSignature not Successful"); } } else { if (NbeXmlDocumentSigner.ValidateSignature(doc, NbeXmlDocumentSigner.GetPrivateKeyFromPath(textBox3.Text, textBox4.Text)) ) //()))//.GetPrivateKeyFromPath(@"C:\Users\d.dvali\Desktop\Aa123456 tsttbcnbe.tbcbank.ge.pfx", "1")))//(@"C:\Users\d.dvali\Desktop\certnew.p7b"))) { MessageBox.Show("CheckedSignature Successful"); } else { MessageBox.Show("CheckedSignature not Successful"); } } } catch (Exception exc) { MessageBox.Show(exc.Message); } }