Package org.ejbca.core.protocol.xkms.client

Examples of org.ejbca.core.protocol.xkms.client.XKMSInvoker


            if (((X509Certificate) trustedcerts[i]).getBasicConstraints() != -1) {
                trustcol.add(trustedcerts[i]);
            }
        }

        XKMSInvoker xKMSInvoker = new XKMSInvoker(SERVICE_URL, trustcol);

        // Test simple validate
        ValidateRequestType validateRequestType = xKMSObjectFactory.createValidateRequestType();
        validateRequestType.setId("200");

        UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier("Test");

        validateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);

        QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        validateRequestType.setQueryKeyBinding(queryKeyBindingType);

        JAXBElement<ValidateRequestType> validateRequest = xKMSObjectFactory.createValidateRequest(validateRequestType);

        Document doc = dbf.newDocumentBuilder().newDocument();
        marshaller.marshal(validateRequest, doc);
        try {
            ValidateResultType validateResultType = xKMSInvoker.validate(validateRequestType, pkCert, key);
            assertTrue(validateResultType.getRequestId().equals("200"));
            assertTrue(validateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        } catch (javax.xml.ws.soap.SOAPFaultException e) {
            log.debug("", e);
            assertTrue("There was a server error. (" + e.getMessage() + ") Did you enable the XKMS CA service?", false);
View Full Code Here


            if (((X509Certificate) trustedcerts[i]).getBasicConstraints() != -1) {
                trustcol.add(trustedcerts[i]);
            }
        }

        XKMSInvoker xKMSInvoker = new XKMSInvoker(SERVICE_URL, trustcol);

        // Test simple validate
        ValidateRequestType validateRequestType = xKMSObjectFactory.createValidateRequestType();
        validateRequestType.setId("201");

        UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier("Test");

        validateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);

        QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        validateRequestType.setQueryKeyBinding(queryKeyBindingType);

        JAXBElement<ValidateRequestType> validateRequest = xKMSObjectFactory.createValidateRequest(validateRequestType);

        Document doc = dbf.newDocumentBuilder().newDocument();
        marshaller.marshal(validateRequest, doc);

        try {
            ValidateResultType validateResultType = xKMSInvoker.validate(validateRequestType, pkCert, key);
            assertTrue(validateResultType.getRequestId().equals("201"));
            assertTrue(validateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
            assertTrue(validateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOAUTHENTICATION));
        } catch (javax.xml.ws.soap.SOAPFaultException e) {
            log.debug("", e);
View Full Code Here

            if (((X509Certificate) trustedcerts[i]).getBasicConstraints() != -1) {
                trustcol.add(trustedcerts[i]);
            }
        }

        XKMSInvoker xKMSInvoker = new XKMSInvoker(SERVICE_URL, trustcol);

        // Test simple validate
        ValidateRequestType validateRequestType = xKMSObjectFactory.createValidateRequestType();
        validateRequestType.setId("200");

        UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier("Test");

        validateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);

        QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        validateRequestType.setQueryKeyBinding(queryKeyBindingType);

        JAXBElement<ValidateRequestType> validateRequest = xKMSObjectFactory.createValidateRequest(validateRequestType);

        Document doc = dbf.newDocumentBuilder().newDocument();
        marshaller.marshal(validateRequest, doc);

        try {
            ValidateResultType validateResultType = xKMSInvoker.validate(validateRequestType, pkCert, key);
            assertTrue(validateResultType.getRequestId().equals("200"));
            assertTrue(validateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
            assertTrue(validateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOAUTHENTICATION));
        } catch (javax.xml.ws.soap.SOAPFaultException e) {
            log.debug("", e);
View Full Code Here

TOP

Related Classes of org.ejbca.core.protocol.xkms.client.XKMSInvoker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.