Package org.wso2.xkms2

Examples of org.wso2.xkms2.RegisterRequest


            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

            request.setAuthentication(authentication);

            RecoverKeyBinding keyBinding = createRecoverKeyBinding();
            keyBinding.setKeyName(alias);

            Status status = new Status();
            status.setStatusValue(StatusValue.INDETERMINATE);
            keyBinding.setStatus(status);

            request.setRecoverKeyBinding(keyBinding);

            request.addRespondWith(RespondWith.PRIVATE_KEY);
View Full Code Here

            ValidateResult validateResult = getValidateResult(result);
            List keybinds = validateResult.getKeyBindingList();
            KeyBinding keybinding = (KeyBinding) keybinds.get(0);

            Status status = keybinding.getStatus();

            return StatusValue.VALID.equals(status.getStatusValue());

        } catch (Exception ex) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("", ex);
            }
View Full Code Here

        kb.setValidityInterval(notBefore, notAfter);
    }

    private void addStatus(boolean valid, KeyBinding kb) {
        Status status = new Status();
        status
                .setStatusValue((valid) ? StatusValue.VALID
                        : StatusValue.INVALID);
        if (valid) {
            status.addValidReason(ValidReason.ISSUER_TRUST);
            status.addValidReason(ValidReason.REVOCATION_STATUS);
            status.addValidReason(ValidReason.SIGNATURE);
            status.addValidReason(ValidReason.VALIDITY_INTERVAL);
        } else {
            status.addInvalidReason(InvalidReason.ISSUER_TRUST);
            status.addInvalidReason(InvalidReason.REVOCATION_STATUS);
            status.addInvalidReason(InvalidReason.SIGNATURE);
            status.addInvalidReason(InvalidReason.VALIDITY_INTERVAL);
        }
        kb.setStatus(status);
    }
View Full Code Here

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

                for (int i = 0; i < keybindings.size(); i++) {
                    UnverifiedKeyBinding unverifiedKeybinding = (UnverifiedKeyBinding) keybindings
                            .get(i);
                    KeyInfo keyInfo = unverifiedKeybinding.getKeyInfo();
                    certs[i] = keyInfo.getX509Certificate();
                }
                return certs;
            }
View Full Code Here

                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();
            }

        } catch (Exception ex) {
View Full Code Here

                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();
            }

        } catch (Exception ex) {
View Full Code Here

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

                for (int i = 0; i < keybindings.size(); i++) {
                    UnverifiedKeyBinding unverifiedKeybinding = (UnverifiedKeyBinding) keybindings
                            .get(i);
                    KeyInfo keyInfo = unverifiedKeybinding.getKeyInfo();
                    aliases[i] = keyInfo.itemKeyName(0).getKeyName();
                }
                return aliases;
            }
View Full Code Here

TOP

Related Classes of org.wso2.xkms2.RegisterRequest

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.