Package org.apache.xml.security.encryption

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


                } else {
                    xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
                    EncryptedData encData = xmlCipher.getEncryptedData();
                    encData.setId(xencEncryptedDataId);
                    encData.setKeyInfo(keyInfo);
                    xmlCipher.doFinal(doc, body, content);         
                }
                if (cloneKeyInfo) {
                    keyInfo = new KeyInfo((Element) keyInfo.getElement().cloneNode(true), null);
                }
            } catch (Exception e2) {
View Full Code Here


                xmlCipher.init(XMLCipher.ENCRYPT_MODE, key);
                EncryptedData encData = xmlCipher.getEncryptedData();
                encData.setId(xencEncryptedDataId);
                encData.setKeyInfo(keyInfo);
                xmlCipher.doFinal(doc, body, content);
            } catch (Exception e2) {
                throw new WSSecurityException(
                        WSSecurityException.FAILED_ENC_DEC, null, null, e2);
            }
            encDataRefs.add(new String("#" + xencEncryptedDataId));
View Full Code Here

            encBodyData = (Element) encBodyData.getParentNode();
        }
        final Node parent = encBodyData.getParentNode();
        final java.util.List before_peers = listChildren(parent);
        try {
            xmlCipher.doFinal(doc, encBodyData, content);
        } catch (Exception e1) {
            throw new WSSecurityException(WSSecurityException.FAILED_ENC_DEC, null, null, e1);
        }
        final java.util.List after_peers = listChildren(parent);
        final java.util.List new_nodes = newNodes(before_peers, after_peers);
View Full Code Here

            try {
                xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
                EncryptedData encData = xmlCipher.getEncryptedData();
                encData.setId(xencEncryptedDataId);
                encData.setKeyInfo(keyInfo);
                xmlCipher.doFinal(doc, body, content);
                if(cloneKeyInfo) {
                    keyInfo = null;
                }
            } catch (Exception e2) {
                throw new WSSecurityException(
View Full Code Here

    if (content) {
      encBodyData = (Element) encBodyData.getParentNode();
    }
    try {
      xmlCipher.doFinal(doc, encBodyData, content);
    } catch (Exception e) {
      throw new WSSecurityException(WSSecurityException.FAILED_ENC_DEC,
          null, null, e);
    }
  }
View Full Code Here

        }
       
        Node previousSibling = elem.getPreviousSibling();

        try {
            xmlCipher.doFinal(elem.getOwnerDocument(), elem, false);
        } catch (Exception e) {
            throw new WSSecurityException(WSSecurityException.FAILED_ENC_DEC,
                    null, null, e);
        }
       
View Full Code Here

              
        // encrypt payloadDoc
        XMLCipher xmlCipher =
            EncryptionUtils.initXMLCipher(symEncAlgo, XMLCipher.ENCRYPT_MODE, symmetricKey);
       
        Document result = xmlCipher.doFinal(payloadDoc, payloadDoc.getDocumentElement(), false);
        NodeList list = result.getElementsByTagNameNS(WSConstants.ENC_NS, "CipherValue");
        if (list.getLength() != 1) {
            throw new WSSecurityException("Payload CipherData is missing", null);
        }
        String cipherText = ((Element)list.item(0)).getTextContent().trim();
View Full Code Here

                    WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex
            );
        }
       
        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

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

            keyInfo.addUnknownElement(encryptedKey.getEncryptedKeyElement());

            encData = xmlCipher.getEncryptedData();
            encData.setId(xencEncryptedDataId);
            encData.setKeyInfo(keyInfo);
            xmlCipher.doFinal(doc, assertionElement, false);
        } catch (Exception e) {
            throw new TrustException(TrustException.REQUEST_FAILED, e);
        }
    }
}
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.