Search in sources :

Example 11 with StatusType

use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.

the class TrustedAuthorityValidatorTest method testAliceSignedByRootIsValid.

@Test
public void testAliceSignedByRootIsValid() throws JAXBException, CertificateException {
    StatusType result = processRequest("validateRequestOKAlice.xml");
    Assert.assertEquals(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID, result.getStatusValue());
    Assert.assertFalse(result.getValidReason().isEmpty());
    Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_ISSUER_TRUST.value(), result.getValidReason().get(0));
}
Also used : StatusType(org.apache.cxf.xkms.model.xkms.StatusType) Test(org.junit.Test)

Example 12 with StatusType

use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.

the class ValidatorTest method testAliceSignedByRootIsValid.

@Test
public void testAliceSignedByRootIsValid() throws JAXBException, CertificateException {
    X509Certificate aliceCertificate = readCertificate("cas/alice.cer");
    ValidateRequestType request = prepareValidateXKMSRequest(aliceCertificate);
    StatusType result = doValidate(request);
    Assert.assertEquals(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID, result.getStatusValue());
    Assert.assertFalse(result.getValidReason().isEmpty());
    Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALIDITY_INTERVAL.value(), result.getValidReason().get(0));
    Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_ISSUER_TRUST.value(), result.getValidReason().get(1));
}
Also used : StatusType(org.apache.cxf.xkms.model.xkms.StatusType) X509Certificate(java.security.cert.X509Certificate) ValidateRequestType(org.apache.cxf.xkms.model.xkms.ValidateRequestType) BasicIntegrationTest(org.apache.cxf.xkms.itests.BasicIntegrationTest) Test(org.junit.Test)

Example 13 with StatusType

use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.

the class ValidatorTest method testWss40DirectTrustNegative.

@Test
public void testWss40DirectTrustNegative() throws JAXBException, CertificateException {
    X509Certificate wss40Certificate = readCertificate("wss40.cer");
    ValidateRequestType request = prepareValidateXKMSRequest(wss40Certificate);
    request.getQueryKeyBinding().getKeyUsage().add(KeyUsageEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_SIGNATURE);
    StatusType result = doValidate(request);
    Assert.assertEquals(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INVALID, result.getStatusValue());
    Assert.assertFalse(result.getInvalidReason().isEmpty());
    Assert.assertEquals(XKMSConstants.DIRECT_TRUST_VALIDATION, result.getInvalidReason().get(0));
}
Also used : StatusType(org.apache.cxf.xkms.model.xkms.StatusType) X509Certificate(java.security.cert.X509Certificate) ValidateRequestType(org.apache.cxf.xkms.model.xkms.ValidateRequestType) BasicIntegrationTest(org.apache.cxf.xkms.itests.BasicIntegrationTest) Test(org.junit.Test)

Example 14 with StatusType

use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.

the class ValidatorTest method testRootCertIsValid.

@Test
public void testRootCertIsValid() throws CertificateException {
    X509Certificate rootCertificate = readCertificate("trusted_cas/root.cer");
    ValidateRequestType request = prepareValidateXKMSRequest(rootCertificate);
    StatusType result = doValidate(request);
    Assert.assertEquals(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID, result.getStatusValue());
    Assert.assertFalse(result.getValidReason().isEmpty());
    Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALIDITY_INTERVAL.value(), result.getValidReason().get(0));
    Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_ISSUER_TRUST.value(), result.getValidReason().get(1));
}
Also used : StatusType(org.apache.cxf.xkms.model.xkms.StatusType) X509Certificate(java.security.cert.X509Certificate) ValidateRequestType(org.apache.cxf.xkms.model.xkms.ValidateRequestType) BasicIntegrationTest(org.apache.cxf.xkms.itests.BasicIntegrationTest) Test(org.junit.Test)

Example 15 with StatusType

use of org.apache.cxf.xkms.model.xkms.StatusType in project cxf by apache.

the class ValidatorTest method testDaveDirectTrust.

@Test
public void testDaveDirectTrust() throws JAXBException, CertificateException {
    X509Certificate daveCertificate = readCertificate("dave.cer");
    ValidateRequestType request = prepareValidateXKMSRequest(daveCertificate);
    request.getQueryKeyBinding().getKeyUsage().add(KeyUsageEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_SIGNATURE);
    StatusType result = doValidate(request);
    Assert.assertEquals(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID, result.getStatusValue());
    Assert.assertFalse(result.getValidReason().isEmpty());
    Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALIDITY_INTERVAL.value(), result.getValidReason().get(0));
    Assert.assertEquals(ReasonEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_ISSUER_TRUST.value(), result.getValidReason().get(1));
    Assert.assertEquals(XKMSConstants.DIRECT_TRUST_VALIDATION, result.getValidReason().get(2));
}
Also used : StatusType(org.apache.cxf.xkms.model.xkms.StatusType) X509Certificate(java.security.cert.X509Certificate) ValidateRequestType(org.apache.cxf.xkms.model.xkms.ValidateRequestType) BasicIntegrationTest(org.apache.cxf.xkms.itests.BasicIntegrationTest) Test(org.junit.Test)

Aggregations

StatusType (org.apache.cxf.xkms.model.xkms.StatusType)24 Test (org.junit.Test)15 X509Certificate (java.security.cert.X509Certificate)12 BasicIntegrationTest (org.apache.cxf.xkms.itests.BasicIntegrationTest)9 ValidateRequestType (org.apache.cxf.xkms.model.xkms.ValidateRequestType)9 KeyBindingType (org.apache.cxf.xkms.model.xkms.KeyBindingType)3 UnverifiedKeyBindingType (org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType)2 XKMSException (org.apache.cxf.xkms.exception.XKMSException)1 Validator (org.apache.cxf.xkms.handlers.Validator)1 KeyUsageEnum (org.apache.cxf.xkms.model.xkms.KeyUsageEnum)1 PrototypeKeyBindingType (org.apache.cxf.xkms.model.xkms.PrototypeKeyBindingType)1 ValidateResultType (org.apache.cxf.xkms.model.xkms.ValidateResultType)1