public void TestSigning_01() { Saml20MetadataDocument doc = new Saml20MetadataDocument(true); EntityDescriptor entity = doc.CreateDefaultEntity(); entity.validUntil = DateTime.Now.AddDays(14); Console.WriteLine(doc.ToXml()); }
public void SignsXml() { // Arrange var doc = new Saml20MetadataDocument(true); var entity = doc.CreateDefaultEntity(); entity.ValidUntil = DateTime.Now.AddDays(14); // Act var metadata = doc.ToXml(); var document = new XmlDocument { PreserveWhitespace = true }; document.LoadXml(metadata); var result = XmlSignatureUtils.CheckSignature(document); // Assert Assert.That(result); }
public void SignsXml() { // Arrange var doc = new Saml20MetadataDocument(true); var entity = doc.CreateDefaultEntity(); entity.ValidUntil = DateTime.Now.AddDays(14); var certificate = new X509Certificate2(FileEmbeddedResource("SAML2.Tests.Certificates.sts_dev_certificate.pfx"), "test1234"); // Act var metadata = doc.ToXml(null, certificate); var document = new XmlDocument { PreserveWhitespace = true }; document.LoadXml(metadata); var result = XmlSignatureUtils.CheckSignature(document); // Assert Assert.That(result); }