2121
2222import com .siemens .pki .cmpclientcomponent .main .CmpClient .EnrollmentResult ;
2323import com .siemens .pki .cmpracomponent .configuration .Configuration ;
24+ import com .siemens .pki .cmpracomponent .msgvalidation .CmpValidationException ;
2425import com .siemens .pki .cmpracomponent .test .framework .ConfigurationFactory ;
2526import com .siemens .pki .cmpracomponent .test .framework .SharedSecret ;
2627import com .siemens .pki .cmpracomponent .test .framework .TestUtils ;
@@ -34,21 +35,29 @@ public class TestPasswordBasedIrWithoutResponseValidation extends EnrollmentTest
3435 @ Before
3536 public void setUp () throws Exception {
3637 final Configuration config =
37- ConfigurationFactory .buildPasswordbasedDownstreamConfigurationWithoutResponseValidation ();
38+ ConfigurationFactory .buildPasswordbasedDownstreamConfigurationWithoutResponseProtection ();
3839 launchCmpCaAndRa (config );
3940 }
4041
41- @ Test
42- public void testIrWithoutResponseValidation () throws Exception {
43- final EnrollmentResult ret = getPasswordBasedCmpClientWithoutResponseValidation (
44- "theCertProfileForOnlineEnrollmentWithoutResponseValidation" ,
45- getClientContext (
46- PKIBody .TYPE_CERT_REQ ,
47- ConfigurationFactory .getKeyGenerator ().generateKeyPair (),
48- null ),
49- new SharedSecret ("PASSWORDBASEDMAC" , TestUtils .PASSWORD ),
50- null )
51- .invokeEnrollment ();
52- assertNotNull (ret );
42+ /**
43+ *
44+ * @throws Throwable if unprotected response is received
45+ */
46+ @ Test (expected = CmpValidationException .class )
47+ public void testIrWithoutResponseValidation () throws Throwable {
48+ try {
49+ final EnrollmentResult ret = getPasswordBasedCmpClientWithoutResponseValidation (
50+ "theCertProfileForOnlineEnrollmentWithoutResponseValidation" ,
51+ getClientContext (
52+ PKIBody .TYPE_CERT_REQ ,
53+ ConfigurationFactory .getKeyGenerator ().generateKeyPair (),
54+ null ),
55+ new SharedSecret ("PASSWORDBASEDMAC" , TestUtils .PASSWORD ),
56+ null )
57+ .invokeEnrollment ();
58+ assertNotNull (ret );
59+ } catch (RuntimeException ex ) {
60+ throw ex .getCause ();
61+ }
5362 }
5463}
0 commit comments