use of com.helger.phase4.model.pmode.leg.PModeLegSecurity in project phase4 by phax.
the class CEFCompatibilityValidatorTwoWayFuncTest method testValidatePModeSecurityNoX509SignatureHashFunction.
@Test
public void testValidatePModeSecurityNoX509SignatureHashFunction() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg2().getSecurity();
aSecurityLeg.setX509SignatureHashFunction(null);
m_aPMode.setLeg2(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, null, null, aSecurityLeg));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("X509SignatureHashFunction is missing")));
}
use of com.helger.phase4.model.pmode.leg.PModeLegSecurity in project phase4 by phax.
the class CEFCompatibilityValidatorTwoWayFuncTest method testValidatePModeSecurityWrongX509SignatureAlgorithm.
@Test
public void testValidatePModeSecurityWrongX509SignatureAlgorithm() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg2().getSecurity();
aSecurityLeg.setX509SignatureAlgorithm(ECryptoAlgorithmSign.RSA_SHA_384);
assertNotSame(ECryptoAlgorithmSign.RSA_SHA_256, aSecurityLeg.getX509SignatureAlgorithm());
m_aPMode.setLeg2(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, null, null, aSecurityLeg));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains(ECryptoAlgorithmSign.RSA_SHA_256.getID())));
}
use of com.helger.phase4.model.pmode.leg.PModeLegSecurity in project phase4 by phax.
the class CEFCompatibilityValidatorTwoWayFuncTest method testValidatePModeSecurityWrongWSSVersion.
@SuppressWarnings("deprecation")
@Test
public void testValidatePModeSecurityWrongWSSVersion() {
final PModeLegSecurity aSecurityLeg = m_aPMode.getLeg2().getSecurity();
aSecurityLeg.setWSSVersion(EWSSVersion.WSS_10);
m_aPMode.setLeg2(new PModeLeg(PModeLegProtocol.createForDefaultSoapVersion("http://test.example.org"), null, null, null, aSecurityLeg));
VALIDATOR.validatePMode(m_aPMode, m_aErrorList);
assertTrue(m_aErrorList.containsAny(x -> x.getErrorText(LOCALE).contains("Security.WSSVersion must use the value WSS_111 instead of WSS_10")));
}
use of com.helger.phase4.model.pmode.leg.PModeLegSecurity in project phase4 by phax.
the class ENTSOGPMode method generatePModeLegSecurity.
@Nonnull
public static PModeLegSecurity generatePModeLegSecurity() {
final PModeLegSecurity aPModeLegSecurity = new PModeLegSecurity();
aPModeLegSecurity.setWSSVersion(EWSSVersion.WSS_111);
aPModeLegSecurity.setX509SignatureAlgorithm(ECryptoAlgorithmSign.RSA_SHA_256);
aPModeLegSecurity.setX509SignatureHashFunction(ECryptoAlgorithmSignDigest.DIGEST_SHA_256);
aPModeLegSecurity.setX509EncryptionAlgorithm(ECryptoAlgorithmCrypt.AES_128_GCM);
aPModeLegSecurity.setX509EncryptionMinimumStrength(Integer.valueOf(128));
aPModeLegSecurity.setPModeAuthorize(false);
aPModeLegSecurity.setSendReceipt(true);
aPModeLegSecurity.setSendReceiptNonRepudiation(true);
aPModeLegSecurity.setSendReceiptReplyPattern(EPModeSendReceiptReplyPattern.RESPONSE);
return aPModeLegSecurity;
}
use of com.helger.phase4.model.pmode.leg.PModeLegSecurity in project phase4 by phax.
the class MockPModeGenerator method getTestPModeWithSecurity.
@Nonnull
public static PMode getTestPModeWithSecurity(@Nonnull final ESoapVersion eSOAPVersion) {
final PMode aPMode = getTestPMode(eSOAPVersion);
final PModeLegSecurity aPModeLegSecurity = new PModeLegSecurity();
aPModeLegSecurity.setWSSVersion(EWSSVersion.WSS_111);
aPModeLegSecurity.setX509SignatureAlgorithm(ECryptoAlgorithmSign.SIGN_ALGORITHM_DEFAULT);
aPModeLegSecurity.setX509SignatureHashFunction(ECryptoAlgorithmSignDigest.SIGN_DIGEST_ALGORITHM_DEFAULT);
aPModeLegSecurity.setX509EncryptionAlgorithm(ECryptoAlgorithmCrypt.ENCRPYTION_ALGORITHM_DEFAULT);
aPModeLegSecurity.setSendReceiptReplyPattern(EPModeSendReceiptReplyPattern.RESPONSE);
aPModeLegSecurity.setSendReceiptNonRepudiation(true);
aPMode.setLeg1(new PModeLeg(_createPModeLegProtocol(eSOAPVersion), _createPModeLegBusinessInformation(eSOAPVersion), _createPModeLegErrorHandling(), null, aPModeLegSecurity));
// Leg 2 stays null, because we only use one-way
return aPMode;
}
Aggregations