ValidateTransportReceipt() public method

public ValidateTransportReceipt ( GuidUtility guidUtility ) : void
guidUtility GuidUtility
return void
            public void TestsertifikatValiderer()
            {
                //Arrange
                AddRsaSha256AlgorithmToCryptoConfig();

                var environment = Miljø.FunksjoneltTestmiljø;
                var sentMessage = XmlUtility.TilXmlDokument(SendtMelding.FunksjoneltTestMiljø);
                var responseValidator = new ResponseValidator(sentMessage, XmlUtility.TilXmlDokument(TransportKvittering.TransportOkKvittertingFunksjoneltTestmiljø), environment.CertificateChainValidator);
                var guidUtility = new GuidUtility
                {
                    BinarySecurityTokenId = "X509-513ffecb-cd7e-4bb3-a4c5-47eff314683f",
                    BodyId = "soapBody",
                    DokumentpakkeId = "*****@*****.**",
                    EbMessagingId = "id-68ae7123-bf5c-4d15-835c-4a6b91106e77",
                    MessageId = "388214db-29cc-43c7-9543-877e017e5bb4",
                    TimestampId = "TS-76740c34-88d2-4bb6-82d2-9e9f0e474087"
                };

                //Act
                responseValidator.ValidateTransportReceipt(guidUtility);

                //Assert
            }
        /// <summary>
        ///     Sender en <see cref="Forsendelse" /> til Meldingsformidler.
        /// </summary>
        /// <param name="forsendelse">
        ///     All informasjon, klar til å kunne sendes (mottakerinformasjon, sertifikater,
        ///     vedlegg mm), enten digitalt eller fysisk.
        /// </param>
        public async Task<Transportkvittering> SendAsync(Forsendelse forsendelse)
        {
            var guidUtility = new GuidUtility();
            Log.Debug($"Utgående forsendelse, conversationId '{forsendelse.KonversasjonsId}', messageId '{guidUtility.MessageId}'.");

            var documentBundle = AsiceGenerator.Create(forsendelse, guidUtility, Databehandler.Sertifikat, Klientkonfigurasjon);
            var forretningsmeldingEnvelope = new ForretningsmeldingEnvelope(new EnvelopeSettings(forsendelse, documentBundle, Databehandler, guidUtility, Klientkonfigurasjon));

            ValidateEnvelopeAndThrowIfInvalid(forretningsmeldingEnvelope, forretningsmeldingEnvelope.GetType().Name);

            var transportReceipt = (Transportkvittering) await RequestHelper.SendMessage(forretningsmeldingEnvelope, documentBundle).ConfigureAwait(false);
            transportReceipt.AntallBytesDokumentpakke = documentBundle.BillableBytes;
            var transportReceiptXml = XmlUtility.TilXmlDokument(transportReceipt.Rådata);

            if (transportReceipt is TransportOkKvittering)
            {
                Log.Debug($"{transportReceipt}");

                var responsvalidator = new ResponseValidator(forretningsmeldingEnvelope.Xml(), transportReceiptXml, Klientkonfigurasjon.Miljø.CertificateChainValidator);
                responsvalidator.ValidateTransportReceipt(guidUtility);
            }
            else
            {
                Log.Error($"{transportReceipt}");
            }

            return transportReceipt;
        }
            public void FeilSecurityBinaryITransportKvitteringSkalKasteException()
            {
                //Arrange
                AddRsaSha256AlgorithmToCryptoConfig();

                //h at the end is replaced with a b
                const string corruptSecurityBinaryResponse = "MIIE7jCCA9agAwIBAgIKGBj1bv99Jpi+EzANBgkqhkiG9w0BAQsFADBRMQswCQYDVQQGEwJOTzEdMBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIzAhBgNVBAMMGkJ1eXBhc3MgQ2xhc3MgMyBUZXN0NCBDQSAzMB4XDTE0MDQyNDEyMzExMVoXDTE3MDQyNDIxNTkwMFowVTELMAkGA1UEBhMCTk8xGDAWBgNVBAoMD1BPU1RFTiBOT1JHRSBBUzEYMBYGA1UEAwwPUE9TVEVOIE5PUkdFIEFTMRIwEAYDVQQFEwk5ODQ2NjExODUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDLTnQryf2bmiyQ9q3ylQ6xMl7EhGIbjuziXkRTfL+M94m3ceAiko+r2piefKCiquLMK4j+UDcOapUtLC4dT4c6GhRH4FIOEn5aNS2I/njTenBypWka/VEhQUj7zvIh5G4UXIDIXYvLd7gideeMtkX24KUh2XVlh+PcqLGHirqBwVfFiTn5SKhr/ojhYYEb2xxTk3AY9nLd1MMffKQwUWmfoTos4scREYGI2R2vWxKWPcDqk+jig2DISWSJSuerz3HMYAAmp+Gjt0oFJNiyOFaFyGwT3DvqwOMQWwWXdmLh1NxMgTpghXAaXae76ucm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lDocument = XmlUtility.TilXmlDokument(SendtMelding.FunksjoneltTestMiljøMedInput());

                var receivedTransportReceipt = XmlUtility.TilXmlDokument(TransportKvittering.TransportOkKvittertingFunksjoneltTestmiljøMedInput(securityBinary: corruptSecurityBinaryResponse));
                var responseValidator = new ResponseValidator(sendtMeldingXmlDocument, receivedTransportReceipt, miljø.CertificateChainValidator);
                var guidUtility = new GuidUtility
                {
                    BinarySecurityTokenId = "X509-513ffecb-cd7e-4bb3-a4c5-47eff314683f",
                    BodyId = "soapBody",
                    DokumentpakkeId = "*****@*****.**",
                    EbMessagingId = "id-68ae7123-bf5c-4d15-835c-4a6b91106e77",
                    MessageId = "388214db-29cc-43c7-9543-877e017e5bb4",
                    TimestampId = "TS-76740c34-88d2-4bb6-82d2-9e9f0e474087"
                };

                //Act
                Assert.Throws<SdpSecurityException>(() =>
                    responseValidator.ValidateTransportReceipt(guidUtility)
                    );
            }
            public void FeilDokumentpakkeIdITransportkvitteringSkalKasteSecurityException()
            {
                //Arrange
                const string idRequest = "*****@*****.**";
                const string idResponse = "*****@*****.**";
                AddRsaSha256AlgorithmToCryptoConfig();

                var environment = Miljø.FunksjoneltTestmiljø;
                var sentMessage = XmlUtility.TilXmlDokument(SendtMelding.FunksjoneltTestMiljøMedInput());

                var transportReceipt = XmlUtility.TilXmlDokument(TransportKvittering.TransportOkKvittertingFunksjoneltTestmiljøMedInput(idResponse));
                var responseValidator = new ResponseValidator(sentMessage, transportReceipt, environment.CertificateChainValidator);

                var guidUtility = new GuidUtility
                {
                    BinarySecurityTokenId = "X509-513ffecb-cd7e-4bb3-a4c5-47eff314683f",
                    BodyId = "soapBody",
                    DokumentpakkeId = idRequest,
                    EbMessagingId = "id-68ae7123-bf5c-4d15-835c-4a6b91106e77",
                    MessageId = "388214db-29cc-43c7-9543-877e017e5bb4",
                    TimestampId = "TS-76740c34-88d2-4bb6-82d2-9e9f0e474087"
                };

                //Act
                Assert.Throws<SdpSecurityException>(() =>
                    responseValidator.ValidateTransportReceipt(guidUtility)
                    );
            }