Package org.wso2.xkms2

Examples of org.wso2.xkms2.Status


        try {

            RecoverRequest request = createRecoverRequest();
            request.setServiceURI(serverURL);

            Authentication authentication = new Authentication();
            Key authenKey = XKMSKeyUtil.getAuthenticationKey(passPhrase);
            authentication.setKeyBindingAuthenticationKey(authenKey);
            request.setAuthentication(authentication);

            RecoverKeyBinding keyBinding = createRecoverKeyBinding();
            keyBinding.setKeyName(alias);
View Full Code Here


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

    public static Authentication createAuthenticate() {
        Authentication authentication = new Authentication();
        return authentication;
    }
View Full Code Here

     * Prepares an KRSSRequest message for validation.
     */
    private void prepare(KRSSRequest request,
            KeyBindingAbstractType abstractType) throws XKMSException {

        Authentication authentication = request.getAuthentication();
        authentication.setKeyBindingAuthenticationKey(authkey);

        KeyInfo keyInfo = abstractType.getKeyInfo();
        if (keyInfo != null) {
            try {

View Full Code Here

    private void validate(KRSSRequest request) throws XKMSException {

        validate((MessageAbstractType) request);

        Authentication authentication = request.getAuthentication();
        XMLSignature keyBindingAuthentication = authentication
                .getKeyBindingAuthentication();

        Key keyBindingAuthenticationKey = authentication
                .getKeyBindingAuthenticationKey();
        try {
            if (!keyBindingAuthentication
                    .checkSignatureValue(keyBindingAuthenticationKey)) {
                throw new XKMSException(XKMSException.NO_AUTHENTICATION,
View Full Code Here

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

        } catch (Exception ex) {
            if (LOG.isDebugEnabled()) {
View Full Code Here

        result.setId(getRamdomId());
        return result;
    }
   
    public static KeyBinding createKeyBinding() {
        KeyBinding keyBinding = new KeyBinding();
        keyBinding.setId(getRamdomId());
        return keyBinding;
    }
View Full Code Here

                BigInteger issuerSerial = cert.getSerialNumber();

                String alias = getAliasForX509Cert(subjectDN, issuerSerial);
                X509Certificate[] certs = getCertificates(alias);

                KeyBinding keyBinding = XKMSUtil.createKeyBinding();
                validateResult.addKeyBinding(keyBinding);

                addKeyInfo(respondWith, alias, certs, keyBinding);
                addKeyUsage(certs[0], keyBinding);
                addStatus(true, keyBinding);

                return validateResult;

            } else {

                ValidateResult result = XKMSUtil.createValidateResult();
                buildResultType((RequestAbstractType) validateRequest,
                        (ResultType) result);

                KeyBinding keybinding = XKMSUtil.createKeyBinding();
                X509Certificate[] certs = new X509Certificate[] { cert };

                addKeyInfo(validateRequest.getRespondWith(), null, certs,
                        keybinding);
                addKeyUsage(certs[0], keybinding);
View Full Code Here

    private void buildResultType(RequestAbstractType request,
            KRSSResult result, String aliase, KeyStore ks) throws XKMSException {

        buildResultType((RequestAbstractType) request, (ResultType) result);

        KeyBinding kb = XKMSUtil.createKeyBinding();
        result.addKeyBinding(kb);

        X509Certificate[] certs = getCertificates(aliase);

        List respondWithList = request.getRespondWith();
View Full Code Here

    }

    public static X509Certificate[] getCertificates(String alias,
                                                    String serviceURL) {
        try {
            LocateRequest request = createLocateRequest();
            request.setServiceURI(serviceURL);

            QueryKeyBinding queryKeybinding = createQueryKeyBinding();
            queryKeybinding.setKeyName(alias);
            request.setQueryKeyBinding(queryKeybinding);

            request.addRespondWith(RespondWith.X_509_CERT);

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

    public static String getAliasForX509Certificate(X509Certificate cert,
                                                    String serviceURL) {
        try {

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

            QueryKeyBinding queryKeybinding = createQueryKeyBinding();

            queryKeybinding.setCertValue(cert);
            queryKeybinding.addUseKeyWith(UseKeyWith.PKIX, cert.getSubjectDN()
                    .getName());

            request.setQueryKeyBinding(queryKeybinding);

            request.addRespondWith(RespondWith.KEY_NAME);

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

TOP

Related Classes of org.wso2.xkms2.Status

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.