public void SetUp() { samlResponse = ObjectMother.Response(); samlResponse.ShouldNotBeNull(); samlResponse.Status.ShouldNotBeNull(); cert = ObjectMother.Certificate2(); samlCert = ObjectMother.SamlCertificateMatching(samlResponse.Issuer, new X509CertificateWrapper(cert)); var store = new X509Store(StoreName.My, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadWrite); store.Add(cert); var certificates = new InMemoryCertificateService(samlCert, cert); var xml = new SamlResponseWriter(certificates, new SamlResponseXmlSigner(), new AssertionXmlEncryptor()).Write(samlResponse); readResponse = new SamlResponseReader(certificates, new AssertionXmlDecryptor()).Read(xml); }