Package org.wso2.xkms2

Examples of org.wso2.xkms2.XKMSElement


                        KeyName keyName = keyInfo.itemKeyName(0);
                        if (keyName != null) {
                            aliases = new String[] { keyName.getKeyName() };
                        }
                    } catch (XMLSecurityException xme) {
                        throw new XKMSException(xme);
                    }
                }

                if (LOG.isDebugEnabled()) {
                    LOG.debug("No SubjectDN is specified");
                }
            } else {
                aliases = getAliasesForDN(identifer);
            }

            byte[] skiValue = getSKIValue(keybinding);
            if (skiValue != null) {
                String alias = getAliasForX509Cert(skiValue);
                if (alias != null) {
                    aliases = new String[] { alias };
                }
            }

            if (aliases == null || aliases.length == 0) {
                throw new XKMSException("KeyNotFound");
            }

            List keyUsage = keybinding.getKeyUsage();
            boolean digitalSigning = keyUsage.contains(KeyUsage.SIGNATURE);
            boolean dataEncryption = keyUsage.contains(KeyUsage.ENCRYPTION);

            List list = new ArrayList();
            for (int i = 0; i < aliases.length; i++) {
                String alias = aliases[i];
                X509Certificate cert = getCertificate(alias);

                if (cert != null) {
                    boolean[] ku = cert.getKeyUsage();

                    if (digitalSigning && !ku[0]) {
                        continue;
                    }
                    if (dataEncryption && !ku[3]) {
                        continue;
                    }
                    list.add(alias);
                }
            }

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

            LocateResult result = XKMSUtil.createLocateResult();
            buildResultType((RequestAbstractType) locate, (ResultType) result);
View Full Code Here


            if (keyInfo != null) {
                try {
                    cert = keyInfo.getX509Certificate();
                } catch (KeyResolverException e) {
                    throw new XKMSException(XKMSException.FAILURE, "keystore",
                            e);
                }
            }

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

            if (verifyTrust(cert)) {
                ValidateResult validateResult = XKMSUtil.createValidateResult();
                buildResultType((RequestAbstractType) validateRequest,
View Full Code Here

                    abstractType.setKeyValue(cert.getPublicKey());
                }

            } catch (KeyResolverException e) {
                LOG.error("", e);
                throw new XKMSException(XKMSException.FAILURE, "noKey", e);

            } catch (XMLSecurityException e) {
                LOG.error("", e);
                throw new XKMSException(XKMSException.FAILURE, "noKey", e);
            }
        }
    }
View Full Code Here

        if (pop != null && key != null) {
            try {
                pop.checkSignatureValue(key);
            } catch (XMLSignatureException se) {
                throw new XKMSException(
                        "Proof-Of-Pocession varification failed", se);
            }
        }

    }
View Full Code Here

                proofOfPossession.checkSignatureValue(key);

            } catch (XMLSignatureException e) {
                LOG.error("", e);

                throw new XKMSException(
                        XKMSException.PROOF_OF_POSSESSION_REQUIRED,
                        "popRequired", e);
            }
        }
    }
View Full Code Here

        Key keyBindingAuthenticationKey = authentication
                .getKeyBindingAuthenticationKey();
        try {
            if (!keyBindingAuthentication
                    .checkSignatureValue(keyBindingAuthenticationKey)) {
                throw new XKMSException(XKMSException.NO_AUTHENTICATION,
                        "invalidXMLSign");
            }
            System.out.println("success");
        } catch (XMLSignatureException e) {
            LOG.error("", e);
            throw new XKMSException(XKMSException.NO_AUTHENTICATION,
                    "invalidXMLSign", e);
        }
    }
View Full Code Here

            try {
                signature.checkSignatureValue(x509Certificate);
            } catch (XMLSignatureException e) {
                LOG.error("", e);
                throw new XKMSException(XKMSException.NO_AUTHENTICATION,
                        "failedXMLSign", e);
            }
        }
    }
View Full Code Here

                String storePass = properties
                        .getProperty(XKMS_KEY_STORE_PASSWORD);
                keystore.store(outputStream, storePass.toCharArray());

            } catch (FileNotFoundException ex) {
                throw new XKMSException(ex);
            } catch (KeyStoreException e) {
                throw new XKMSException(e);
            } catch (NoSuchAlgorithmException e) {
                throw new XKMSException(e);
            } catch (CertificateException e) {
                throw new XKMSException(e);
            } catch (IOException e) {
                throw new XKMSException(e);
            }
        }
    }
View Full Code Here

                        return alias;
                    }
                }
            }
        } catch (KeyStoreException e) {
            throw new XKMSException("keystore");
        }
        return null;
    }
View Full Code Here

                        aliases.add(alias);
                    }
                }
            }
        } catch (KeyStoreException e) {
            throw new XKMSException(e);
        }
        return aliases;
    }
View Full Code Here

TOP

Related Classes of org.wso2.xkms2.XKMSElement

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.