Package org.wso2.xkms2.builder

Examples of org.wso2.xkms2.builder.RecoverRequestBuilderTest


        try {
            prepare(request, request.getReissueKeyBinding());
            validate(request);

            ReissueKeyBinding rkb = request.getReissueKeyBinding();
            X509Certificate cert = rkb.getCertValue();

            if (cert == null) {
                throw new XKMSException(XKMSException.FAILURE, "CertNotPresent");
            }
View Full Code Here


    }

    private void validate(ReissueRequest reissueRequest) throws XKMSException {
        validate((KRSSRequest) reissueRequest);

        ReissueKeyBinding rkb = reissueRequest.getReissueKeyBinding();
        XMLSignature pop = reissueRequest.getProofOfPocession();

        Key key = rkb.getKeyValue();
        if (key == null) {
            X509Certificate cert = rkb.getCertValue();

            if (cert != null) {
                key = cert.getPublicKey();
            }
        }
View Full Code Here

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

    public static ReissueRequest createReissueRequest() {
        ReissueRequest reissueRequest = new ReissueRequest();
        reissueRequest.setId(XKMSUtil.getRamdomId());
        return reissueRequest;
    }
View Full Code Here

        recoverResult.setId(getRamdomId());
        return recoverResult;
    }
   
    public static ReissueResult creatReissueResult() {
        ReissueResult reissueResult = new ReissueResult();
        reissueResult.setId(getRamdomId());
        return reissueResult;
    }
View Full Code Here

            if (alias == null) {
                throw new XKMSException(XKMSException.FAILURE, "CertNotFound");
            }

            ReissueResult result = XKMSUtil.creatReissueResult();
            buildResultType(request, result, alias, keystore);
            return result;

        } catch (XKMSException ex) {
            ReissueResult result = XKMSUtil.creatReissueResult();
            buildFault(request, result, ex);
            return result;
        }
    }
View Full Code Here

   
    private ReissueResultBuilder() {
    }

    public XKMSElement buildElement(OMElement element) throws XKMSException {
        ReissueResult reissueResult = new ReissueResult();
        super.buildElement(element, reissueResult);

        OMElement keyBindingElem;
        for (Iterator iterator = element
                .getChildrenWithName(XKMS2Constants.ELE_KEY_BINDING); iterator
                .hasNext();) {
            keyBindingElem = (OMElement) iterator.next();
            reissueResult
                    .addKeyBinding((KeyBinding) KeyBindingBuilder.INSTANCE
                            .buildElement(keyBindingElem));
        }
       
        return reissueResult;
View Full Code Here

    }

    public ResultType process(XKMSRequestData data) throws AxisFault {

        RequestAbstractType request = data.getRequest();
        this.doc = data.getDocument();

        if (request instanceof RegisterRequest) {
            return handleRegisterRequest((RegisterRequest) request);
View Full Code Here

            X509Certificate[] certs, KeyBindingAbstractType abstractType) {

        KeyInfo keyInfo = new KeyInfo(doc);

        for (Iterator iterator = respondWiths.iterator(); iterator.hasNext();) {
            RespondWith respondWith = (RespondWith) iterator.next();

            if (respondWith.equals(RespondWith.KEY_NAME)) {
                KeyName keyName = new KeyName(doc, aliase);
                keyInfo.add(keyName);

            } else if (respondWith.equals(RespondWith.KEY_VALUE)) {
                PublicKey publicKey = certs[0].getPublicKey();
                KeyValue keyValue = new KeyValue(doc, publicKey);
                keyInfo.add(keyValue);

            } else if (respondWith.equals(RespondWith.X_509_CERT)) {
                addX509Certificate(certs[0], keyInfo);

            } else if (respondWith.equals(RespondWith.X_509_CHAIN)) {
                for (int i = 0; i < certs.length; i++) {
                    addX509Certificate(certs[i], keyInfo);
                }

            } else {
View Full Code Here

            OMElement result = sendReceive(element, serverURL);
            result = buildElement(result);

            RecoverResult recoverResult = getRecoverResult(result);

            ResultMinor resultMinor = recoverResult.getResultMinor();
            if (resultMinor != null && ResultMinor.NO_MATCH.equals(resultMinor)) {
                return null;
            }

            org.wso2.xkms2.PrivateKey xkmsPrivateKey = recoverResult
View Full Code Here

    private RevokeRequestBuilder() {
    }

    public XKMSElement buildElement(OMElement element) throws XKMSException {
        RevokeRequest revokeRequest = new RevokeRequest();
        super.buildElement(element, revokeRequest);

        OMElement revokeKeyBindingElement = element
                .getFirstChildWithName(XKMS2Constants.Q_ELEM_REVOKE_KEY_BINDING);

        if (revokeKeyBindingElement == null) {
            throw new XKMSException("RevokeKeyBinding element not found");
        }
        revokeRequest
                .setRevokeKeyBinding((RevokeKeyBinding) RevokeKeyBindingBuilder.INSTANCE
                        .buildElement(revokeKeyBindingElement));

        if (revokeRequest.getAuthentication() == null) {
            OMElement revocationCodeElem = element
                    .getFirstChildWithName(XKMS2Constants.Q_ELEM_REVOCATION_CODE);
            if (revocationCodeElem != null) {
                revokeRequest.setRevocationCode(Base64.decode(revocationCodeElem
                        .getText()));
            } else {
                throw new XKMSException(
                        "Neither Authentication nor RevocationCode found");
            }
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.