Package org.wso2.xkms2

Examples of org.wso2.xkms2.XKMSException


            } else if (certs == null) {
                // At this pont we don't have certs or a cert
                return null;
            }
        } catch (KeyStoreException e) {
            throw new XKMSException("keystore");
        }

        X509Certificate[] x509certs = new X509Certificate[certs.length];
        for (int i = 0; i < certs.length; i++) {
            x509certs[i] = (X509Certificate) certs[i];
View Full Code Here


            certs = getCertificates(alias);

            // If no certificates have been found, there has to be an error:
            // The keystore can find an alias but no certificate(s)
            if (certs == null | certs.length < 1) {
                throw new XKMSException("noCertForAlias");
            }

            // Form a certificate chain from the transmitted certificate
            // and the certificate(s) of the issuer from the keystore
            // First, create new array
View Full Code Here

                if (Arrays.equals(data, skiBytes)) {
                    return alias;
                }
            }
        } catch (KeyStoreException e) {
            throw new XKMSException(e);
        }
        return null;
    }
View Full Code Here

        byte[] derEncodedValue = cert.getExtensionValue(SKI_OID);

        if (cert.getVersion() < 3 || derEncodedValue == null) {
            PublicKey key = cert.getPublicKey();
            if (!(key instanceof RSAPublicKey)) {
                throw new XKMSException("noSKIHandling");
            }
            byte[] encoded = key.getEncoded();
            // remove 22-byte algorithm ID and header
            byte[] value = new byte[encoded.length - 22];
            System.arraycopy(encoded, 22, value, 0, value.length);
            MessageDigest sha;
            try {
                sha = MessageDigest.getInstance("SHA-1");
            } catch (NoSuchAlgorithmException ex) {
                throw new XKMSException("noSKIHandling");
            }
            sha.reset();
            sha.update(value);
            return sha.digest();
        }
View Full Code Here

        SOAPEnvelope env = msgCtx.getEnvelope();
        OMElement llomElement = env.getBody().getFirstElement();

        if (llomElement == null) {
            throw new XKMSException(XKMSException.INCOMPLETE, "RequiredDataMissing");   
        }

        XKMSUtil.DOOMElementMetadata doomMetadata = XKMSUtil
                .getDOOMElement(llomElement);
        OMElement xkmsElement = doomMetadata.getElement();
View Full Code Here

        super.buildElement(element, reissueRequest);

        OMElement reissueKeyBindingElement = element
                .getFirstChildWithName(XKMS2Constants.Q_ELEM_REISSUE_KEY_BINDING);
        if (reissueKeyBindingElement == null) {
            throw new XKMSException("ReissueKeyBinding element not found");
        }

        reissueRequest
                .setReissueKeyBinding((ReissueKeyBinding) ReissueKeyBindingBuilder.INSTANCE
                        .buildElement(reissueKeyBindingElement));

        OMElement proofOfPossessionElem = element
                .getFirstChildWithName(XKMS2Constants.Q_ELEM_PROOF_OF_POSSESSION);
        if (proofOfPossessionElem != null) {
            OMElement xmlSigElem = proofOfPossessionElem
                    .getFirstChildWithName(XKMS2Constants.Q_ELEM_XML_SIG);
            XMLSignature signature;
            try {
                signature = new XMLSignature((Element) xmlSigElem, "");
                reissueRequest.setProofOfPocession(signature);

            } catch (XMLSignatureException e) {
                throw new XKMSException(e);

            } catch (XMLSecurityException e) {
                throw new XKMSException(e);
            }
        }

        return reissueRequest;
    }
View Full Code Here

        try {
            XMLSignature signature = new XMLSignature(sigElement, "");
            registerRequest.setProofOfPossesion(signature);

        } catch (XMLSignatureException e) {
            throw new XKMSException(e);
        } catch (XMLSecurityException e) {
            throw new XKMSException(e);
        }
    }
View Full Code Here

    public XKMSElement buildElement(OMElement element) throws XKMSException {
        QName qName = element.getQName();
        if (!(qName.getLocalPart().equals("LocateRequest") &&
              qName.getNamespaceURI().equals(XKMS2Constants.XKMS2_NS))) {
            throw new XKMSException("LocateRequest is not the first element");

        }
        super.buildElement(element, locateRequest);
        return locateRequest;
    }
View Full Code Here

        super.buildElement(element, recoverRequest);

        OMElement recoverKeyBindingElem = element
                .getFirstChildWithName(XKMS2Constants.Q_ELEM_RECOVER_KEY_BINDING);
        if (recoverKeyBindingElem == null) {
            throw new XKMSException("RecoverKeyBinding is not present");
        }

        recoverRequest
                .setRecoverKeyBinding((RecoverKeyBinding) RecoverKeyBindingBuilder.INSTANCE
                        .buildElement(recoverKeyBindingElem));
View Full Code Here

        try {
            XMLSignature signature = new XMLSignature((Element) signElement, "");
            authentication.setKeyBindingAuthentication(signature);

        } catch (XMLSecurityException se) {
            throw new XKMSException(se);
        }
    }
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.