diff --git a/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4IncomingMessageState.java b/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4IncomingMessageState.java index 16cb7380b..e7f2ac62c 100644 --- a/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4IncomingMessageState.java +++ b/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4IncomingMessageState.java @@ -40,6 +40,7 @@ import com.helger.commons.datetime.XMLOffsetDateTime; import com.helger.phase4.attachment.EAS4CompressionMode; import com.helger.phase4.attachment.WSS4JAttachment; +import com.helger.phase4.crypto.IAS4CryptoFactory; import com.helger.phase4.ebms3header.Ebms3Messaging; import com.helger.phase4.mgr.MetaAS4Manager; import com.helger.phase4.model.ESoapVersion; @@ -85,7 +86,9 @@ public final class AS4IncomingMessageState extends AttributeContainerAny null. If this is + * non-null it is NO indicator, whether a message was + * signed or not. + * @see #isSoapSignatureChecked() + * @since 3.0.0-beta6 + */ + @Nullable + IAS4CryptoFactory getCryptoFactorySign (); + + /** + * @return The crypto factory that was used to decrypt an eventually encrypted + * message. May be null. If this is non-null + * it is NO indicator, whether a message was encrypted or not. + * @see #isSoapDecrypted() + * @since 3.0.0-beta6 + */ + @Nullable + IAS4CryptoFactory getCryptoFactoryCrypt (); } diff --git a/phase4-lib/src/main/java/com/helger/phase4/incoming/soap/SoapHeaderElementProcessorWSS4J.java b/phase4-lib/src/main/java/com/helger/phase4/incoming/soap/SoapHeaderElementProcessorWSS4J.java index ccd84b704..e51f175b9 100644 --- a/phase4-lib/src/main/java/com/helger/phase4/incoming/soap/SoapHeaderElementProcessorWSS4J.java +++ b/phase4-lib/src/main/java/com/helger/phase4/incoming/soap/SoapHeaderElementProcessorWSS4J.java @@ -349,11 +349,14 @@ public ESuccess processHeaderElement (@Nonnull final Document aSoapDoc, @Nonnull final AS4IncomingMessageState aIncomingState, @Nonnull final ICommonsList aProcessingErrorMessagesTarget) { + // Remember the crypto factories used for this message + aIncomingState.setCryptoFactorySign (m_aCryptoFactorySign); + aIncomingState.setCryptoFactoryCrypt (m_aCryptoFactoryCrypt); + + // Make sure a PMode is selected IPMode aPMode = aIncomingState.getPMode (); if (aPMode == null) aPMode = m_aFallbackPModeProvider.get (); - - // Safety Check if (aPMode == null) throw new IllegalStateException ("No PMode contained in AS4 state - seems like Ebms3 Messaging header is missing!");