Package org.apache.xml.security.encryption

Examples of org.apache.xml.security.encryption.XMLCipher.doFinal()


        encrKeyProcessor.getDecryptedBytes());

    cipher = XMLCipher.getInstance();
    cipher.init(XMLCipher.DECRYPT_MODE, secretKey);

    doc = cipher.doFinal(encryptedToken.getOwnerDocument(), encryptedToken);

    if (log.isDebugEnabled()) {
      log.debug("decryptingTokenDone");
    }
View Full Code Here


            .getDecryptedBytes());

    XMLCipher cipher = XMLCipher.getInstance();
    cipher.init(XMLCipher.DECRYPT_MODE, secretKey);

    Document doc = cipher.doFinal(encryptedToken.getOwnerDocument(), encryptedToken);

    return doc.getDocumentElement();
  }

  private static byte[] readBytesFromFile(String filePath) throws IOException {
View Full Code Here

            .getDecryptedBytes());

    XMLCipher cipher = XMLCipher.getInstance();
    cipher.init(XMLCipher.DECRYPT_MODE, secretKey);

    Document doc = cipher.doFinal(encryptedToken.getOwnerDocument(), encryptedToken);

    return doc.getDocumentElement();
  }

  private static byte[] readBytesFromFile(String filePath) throws IOException {
View Full Code Here

                            .getDecryptedBytes());

            XMLCipher cipher = XMLCipher.getInstance();
            cipher.init(XMLCipher.DECRYPT_MODE, secretKey);

            Document doc = cipher.doFinal(encryptedToken.getOwnerDocument(), encryptedToken);

            return doc.getDocumentElement();
        } catch (Exception e) {
            log.error("error occured while decryptng the token", e);
            throw e;
View Full Code Here

        try {

            Document doc = element.getOwnerDocument();
            XMLCipher xmlCipher = XMLCipher.getInstance(algorithm);
            xmlCipher.init(XMLCipher.ENCRYPT_MODE, key);
            xmlCipher.doFinal(doc, element, true);

        } catch (Exception e) {
            e.printStackTrace();
            throw new XKMSException(e);
        }
View Full Code Here

    public void decryptData(Key key, Document doc) throws XKMSException {
        try {
            XMLCipher xmlCipher = XMLCipher.getInstance();
            xmlCipher.init(XMLCipher.DECRYPT_MODE, key);
            xmlCipher.doFinal(doc, encryptedData, true);

            OMElement rsaKeyPairElem = ((OMElement) encryptedData)
                    .getFirstChildWithName(XKMS2Constants.Q_ELEM_RSA_KEY_PAIR);
            rsaKeyPair = (RSAKeyPair) RSAKeyPairTypeBuilder.INSTANCE
                    .buildElement(rsaKeyPairElem);
View Full Code Here

        NodeList nodeList = document.getElementsByTagNameNS(
                XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
                XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
            );
        Element ee = (Element)nodeList.item(0);
        return cipher.doFinal(document, ee);
    }

}
View Full Code Here

        DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
        Document document = builder.parse(file);

        XMLCipher cipher = XMLCipher.getInstance("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
        cipher.init(XMLCipher.ENCRYPT_MODE, encryptionSymKey);
        document = cipher.doFinal(document, document.getDocumentElement());

        XMLUtils.outputDOM(document, new BufferedOutputStream(new FileOutputStream(new File(getTmpFilePath(), "encryption-dom-" + tagCount + ".xml"))));
    }

    protected void doDOMDecryptionInbound(File file, int tagCount) throws Exception {
View Full Code Here

        DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
        Document document = builder.parse(file);

        XMLCipher cipher = XMLCipher.getInstance("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
        cipher.init(XMLCipher.DECRYPT_MODE, encryptionSymKey);
        cipher.doFinal(document, document.getDocumentElement());
    }
}
View Full Code Here

            encData = (Element) encData.getParentNode();
            parent = encData.getParentNode();
        }
       
        try {
            xmlCipher.doFinal(doc, encData, content);
        } catch (Exception ex) {
            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK, ex);
        }
       
        if (parent.getLocalName().equals(WSConstants.ENCRYPTED_HEADER)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.