Package org.wso2.xkms2

Examples of org.wso2.xkms2.XKMSException


                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

    public static boolean validateCertPath(X509Certificate cert,
                                           String serviceURL) {
        try {

            ValidateRequest request = createValidateRequest();
            request.setServiceURI(serviceURL);

            QueryKeyBinding keyBinding = createQueryKeyBinding();
            keyBinding.setCertValue(cert);

            String name = cert.getSubjectDN().getName();
            keyBinding.addUseKeyWith(UseKeyWith.PKIX, name);

            request.setQueryKeyBinding(keyBinding);
            request.addRespondWith(RespondWith.X_509_CERT);

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

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

    public static ValidateRequest createValidateRequest() {
        ValidateRequest validate = new ValidateRequest();
        validate.setId(XKMSUtil.getRamdomId());
        return validate;
    }
View Full Code Here

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

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

            Status status = keybinding.getStatus();

            return StatusValue.VALID.equals(status.getStatusValue());
View Full Code Here

        locateResult.setId(getRamdomId());
        return locateResult;
    }
   
    public static ValidateResult createValidateResult() {
        ValidateResult validateResult = new ValidateResult();
        validateResult.setId(getRamdomId());
        return validateResult;
    }
View Full Code Here

        return prototypeKeyBinding;
    }

    private void processValidityInterval(OMElement validityIntervalElem)
            throws XKMSException {
        ValidityInterval validityInterval = new ValidityInterval();

        String strNotBefore = validityIntervalElem
                .getAttributeValue(XKMS2Constants.Q_ATTR_NOT_BEFORE);
        String strNotOnOrAfter = validityIntervalElem
                .getAttributeValue(XKMS2Constants.Q_ATTR_NOT_ON_OR_AFTER);

        DateFormat zulu = new XmlSchemaDateFormat();

        try {
            if (strNotBefore != null) {
                Calendar calendar = Calendar.getInstance();
                calendar.setTime(zulu.parse(strNotBefore));
                validityInterval.setNotBefore(calendar);
            }

            if (strNotOnOrAfter != null) {
                Calendar calendar = Calendar.getInstance();
                calendar.setTime(zulu.parse(strNotOnOrAfter));
                validityInterval.setNotOnOrAfter(calendar);
            }

        } catch (ParseException xkmse) {
            throw new XKMSException(xkmse);
        }
View Full Code Here

                calendar.setTime(zulu.parse(strNotOnOrAfter));
                validityInterval.setNotOnOrAfter(calendar);
            }

        } catch (ParseException xkmse) {
            throw new XKMSException(xkmse);
        }

        prototypeKeyBinding.setValidityInterval(validityInterval);
    }
View Full Code Here

            return factory.newDocumentBuilder().parse(bais)
                    .getDocumentElement();

        } catch (XMLStreamException e) {
            log.error(e);
            throw new XKMSException(e);
        } catch (IOException e) {
            log.error(e);
            throw new XKMSException(e);
        } catch (ParserConfigurationException e) {
            log.error(e);
            throw new XKMSException(e);
        } catch (SAXException e) {
            log.error(e);
            throw new XKMSException(e);
        }

    }
View Full Code Here

            buider = new StAXOMBuilder(new ByteArrayInputStream(bos
                    .toByteArray()));
            return buider.getDocumentElement();
        } catch (IOException e) {
            log.error(e);
            throw new XKMSException(e);
        } catch (CanonicalizationException e) {
            log.error(e);
            throw new XKMSException(e);
        } catch (InvalidCanonicalizerException e) {
            log.error(e);
            throw new XKMSException(e);
        } catch (XMLStreamException e) {
            log.error(e);
            throw new XKMSException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.xkms2.XKMSException

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.