Exemplo n.º 1
0
        public void TestBug38()
        {
            X509Certificate2 certificate = GetTestCertificate();
            XmlDocument      document    = XadesHelper.Sign(_bug38InputFilePath).Using(certificate).IncludingCertificateInSignature().SignAndGetXml();

            Assert.IsNotNullOrEmpty(document.OuterXml);
        }
Exemplo n.º 2
0
        private void btnValidate_Click(object sender, EventArgs e)
        {
            var results = XadesHelper.Verify(txtFileToValidate.Text).PerformAndGetResults();

            txtOriginalXml.Text = results.OriginalDocument.OuterXml;
            txtTimestamp.Text   = results.Timestamp;
            txtCertificate.Text = results.SigningCertificate.Subject;
            MessageBox.Show(@"Signature verified!");
        }
Exemplo n.º 3
0
        private void btnFirmar_Click(object sender, EventArgs e)
        {
            var outputPath          = txtOutputFile.Text;
            var selectedCertificate = GetSelectedCertificate();
            var inputPath           = txtFileToSign.Text;

            var howToSign =
                XadesHelper.Sign(inputPath).Using(selectedCertificate).
                IncludingCertificateInSignature();

            if (chkAddProperty.Checked)
            {
                howToSign.WithProperty(txtPropertyName.Text, txtPropertyValue.Text, "http://xades.codeplex.com/#properties");
            }
            howToSign.SignToFile(outputPath);
            XadesHelper.Verify(outputPath).Perform();

            MessageBox.Show(@"Signature created and verified successfully :)");
        }
Exemplo n.º 4
0
 private XmlDocument SignXadesBes(string inputPath, X509Certificate2 selectedCertificate)
 {
     return(XadesHelper.Sign(inputPath).Using(selectedCertificate).
            IncludingCertificateInSignature().SignAndGetXml());
 }