Package org.wso2.xkms2.builder

Examples of org.wso2.xkms2.builder.RecoverRequestBuilderTest


    public static String getAliasForX509Certificate(byte[] skiValue,
                                                    String serviceURL) {
        try {

            LocateRequest request = createLocateRequest();
            request.setServiceURI(serviceURL);

            QueryKeyBinding queryKeybinding = createQueryKeyBinding();
            queryKeybinding.addUseKeyWith(UseKeyWith.SKI, Base64
                    .encode(skiValue));
            request.setQueryKeyBinding(queryKeybinding);

            request.addRespondWith(RespondWith.KEY_NAME);

            OMElement element = getAsOMElement(request);
            OMElement result = sendReceive(element, serviceURL);
            result = buildElement(result);
View Full Code Here


        }
    }

    public static String[] getAliasesForDN(String subjectDN, String serviceURL) {
        try {
            LocateRequest request = createLocateRequest();
            request.setServiceURI(serviceURL);

            QueryKeyBinding queryKeybinding = createQueryKeyBinding();
            queryKeybinding.addUseKeyWith(UseKeyWith.PKIX, subjectDN);
            request.setQueryKeyBinding(queryKeybinding);

            request.addRespondWith(RespondWith.KEY_NAME);

            OMElement element = getAsOMElement(request);
            OMElement result = sendReceive(element, serviceURL);
            result = buildElement(result);
View Full Code Here

        validate.setId(XKMSUtil.getRamdomId());
        return validate;
    }

    public static LocateRequest createLocateRequest() {
        LocateRequest locate = new LocateRequest();
        locate.setId(XKMSUtil.getRamdomId());
        return locate;
    }
View Full Code Here

            OMElement element = getAsOMElement(request);
            OMElement result = sendReceive(element, serviceURL);
            result = buildElement(result);

            LocateResult locateResult = getLocateResult(result);

            if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
                return null;

            } else {

                List keybindings = locateResult.getUnverifiedKeyBindingList();
                X509Certificate[] certs = new X509Certificate[keybindings
                        .size()];

                for (int i = 0; i < keybindings.size(); i++) {
                    UnverifiedKeyBinding unverifiedKeybinding = (UnverifiedKeyBinding) keybindings
View Full Code Here

            OMElement element = getAsOMElement(request);
            OMElement result = sendReceive(element, serviceURL);
            result = buildElement(result);

            LocateResult locateResult = getLocateResult(result);

            if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
                return null;

            } else {

                List keybindings = locateResult.getUnverifiedKeyBindingList();
                UnverifiedKeyBinding keybinding = (UnverifiedKeyBinding) keybindings
                        .get(0);
                KeyInfo keyInfo = keybinding.getKeyInfo();
                KeyName keyName = keyInfo.itemKeyName(0);
                return keyName.getKeyName();
View Full Code Here

            OMElement element = getAsOMElement(request);
            OMElement result = sendReceive(element, serviceURL);
            result = buildElement(result);

            LocateResult locateResult = getLocateResult(result);

            if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
                return null;

            } else {

                List keybindings = locateResult.getUnverifiedKeyBindingList();
                UnverifiedKeyBinding keybinding = (UnverifiedKeyBinding) keybindings
                        .get(0);
                KeyInfo keyInfo = keybinding.getKeyInfo();
                KeyName keyName = keyInfo.itemKeyName(0);
                return keyName.getKeyName();
View Full Code Here

            OMElement element = getAsOMElement(request);
            OMElement result = sendReceive(element, serviceURL);
            result = buildElement(result);

            LocateResult locateResult = getLocateResult(result);

            if (ResultMinor.NO_MATCH.equals(locateResult.getResultMinor())) {
                return null;

            } else {

                List keybindings = locateResult.getUnverifiedKeyBindingList();
                String[] aliases = new String[keybindings.size()];

                for (int i = 0; i < keybindings.size(); i++) {
                    UnverifiedKeyBinding unverifiedKeybinding = (UnverifiedKeyBinding) keybindings
                            .get(i);
View Full Code Here

        return request.serialize(factory);
    }

    private static LocateResult getLocateResult(OMElement result)
            throws Exception {
        LocateResult locateResult = (LocateResult) LocateResultBuilder.INSTANCE
                .buildElement(result);
        return locateResult;
    }
View Full Code Here

        reissueResult.setId(getRamdomId());
        return reissueResult;
    }
   
    public static LocateResult createLocateResult() {
        LocateResult locateResult = new LocateResult();
        locateResult.setId(getRamdomId());
        return locateResult;
    }
View Full Code Here

            if (list.isEmpty()) {
                throw new XKMSException(XKMSException.NO_MATCH, "KeyNotFound");
            }

            LocateResult result = XKMSUtil.createLocateResult();
            buildResultType((RequestAbstractType) locate, (ResultType) result);

            for (Iterator iterator = list.iterator(); iterator.hasNext();) {
                String alias = (String) iterator.next();
                X509Certificate[] certs = getCertificates(alias);
                UnverifiedKeyBinding ukb = new UnverifiedKeyBinding();

                addKeyInfo(locate.getRespondWith(), alias, certs, ukb);
                addKeyUsage(certs[0], ukb);
                result.addUnverifiedKeyBinding(ukb);
            }

            return result;

        } catch (XKMSException ex) {
            LocateResult result = XKMSUtil.createLocateResult();
            buildFault(locate, result, ex);
            return result;
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.xkms2.builder.RecoverRequestBuilderTest

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.