public void formats_and_load_via_string()
        {
            var cert1 = new SamlCertificate
            {
                Issuer = "foo:bar1",
                SerialNumber = "12345",
                CertificateIssuer = "DN=Foo",
                Thumbprint = "ab cd ef"
            };

            var cert2 = new SamlCertificate(cert1.ToString());

            cert2.ShouldNotBeTheSameAs(cert1);

            cert2.Issuer.ShouldBe(cert1.Issuer);
            cert2.SerialNumber.ShouldBe(cert1.SerialNumber);
            cert2.CertificateIssuer.ShouldBe(cert1.CertificateIssuer);
            cert2.Thumbprint.ShouldBe(cert1.Thumbprint);
        }
        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);
        }
 public InMemoryCertificateService(SamlCertificate certificate, X509Certificate2 realCertificate)
 {
     _certificate = certificate;
     _realCertificate = realCertificate;
 }