public async Task Untouched_Forwarded_Message_Has_Still_Valid_Signature() { // Arrange string ebmsMessageId = $"user-{Guid.NewGuid()}"; IConfig configuration = _msh.GetConfiguration(); AS4Message tobeForwarded = CreateSignedAS4Message(ebmsMessageId, configuration); // Act InsertToBeForwardedMessage( msh: _msh, pmodeId: "Forwarding_Untouched_Push", mep: MessageExchangePattern.Push, tobeForwarded: tobeForwarded); // Assert var databaseSpy = DatabaseSpy.Create(configuration); OutMessage tobeSentRecord = await PollUntilPresent( () => databaseSpy.GetOutMessageFor(m => m.EbmsMessageId == ebmsMessageId && m.Operation == Operation.ToBeSent), timeout : TimeSpan.FromSeconds(20)); Registry.Instance .MessageBodyStore .SaveAS4Message( configuration.InMessageStoreLocation, tobeForwarded); using (Stream tobeSentContents = await tobeSentRecord.RetrieveMessageBody(Registry.Instance.MessageBodyStore)) { AS4Message tobeSentMessage = await SerializerProvider .Default .Get(tobeSentRecord.ContentType) .DeserializeAsync(tobeSentContents, tobeSentRecord.ContentType); bool validSignature = tobeSentMessage.VerifySignature( new VerifySignatureConfig( allowUnknownRootCertificateAuthority: false, attachments: tobeSentMessage.Attachments)); Assert.True(validSignature, "Forwarded AS4Message hasn't got a valid signature present while the message was forwaded 'untouched'"); } }