Esempio n. 1
0
        public void TestVerifyValidDocument()
        {
            DigitalSignatureServiceClient client = new DigitalSignatureServiceClientImpl(DSS_LOCATION);

            bool result = client.Verify(validSignedDocument, "text/xml");

            Assert.True(result);
        }
Esempio n. 2
0
        public void TestVerifyValidDocumentSslNoTlsAuthn()
        {
            DigitalSignatureServiceClient client = new DigitalSignatureServiceClientImpl(DSS_LOCATION_SSL);

            client.ConfigureSsl(null);

            bool result = client.Verify(validSignedDocument, "text/xml");

            Assert.True(result);
        }
Esempio n. 3
0
        public void TestVerifyValidDocumentValidTlsAuthn()
        {
            X509Certificate2 sslCertificate = new X509Certificate2(SSL_CERT_PATH);

            DigitalSignatureServiceClient client = new DigitalSignatureServiceClientImpl(DSS_LOCATION_SSL);

            client.ConfigureSsl(sslCertificate);

            bool result = client.Verify(validSignedDocument, "text/xml");

            Assert.True(result);
        }
Esempio n. 4
0
        public void TestVerifyInvalidSignatureDocument()
        {
            DigitalSignatureServiceClient client = new DigitalSignatureServiceClientImpl(DSS_LOCATION);

            try
            {
                client.Verify(invalidSignedDocument, "text/xml");
                Assert.Fail();
            }
            catch (SystemException e)
            {
                // expected
                Console.WriteLine("SystemException: " + e.Message);
            }
        }
Esempio n. 5
0
        public void TestVerifyValidDocumentInvalidTlsAuthn()
        {
            X509Certificate2 invalidSslCertificate = new X509Certificate2(INVALID_SSL_CERT_PATH);
            DigitalSignatureServiceClient client   = new DigitalSignatureServiceClientImpl(DSS_LOCATION_SSL);

            client.ConfigureSsl(invalidSslCertificate);
            try
            {
                client.Verify(validSignedDocument, "text/xml");
                Assert.Fail();
            }
            catch (SecurityNegotiationException e)
            {
                // expected
                Console.WriteLine("SystemException: " + e.Message);
            }
        }