Package org.apache.xml.security.encryption

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


      }

      // Create a new cipher just to be paranoid
      XMLCipher cipher3 = XMLCipher.getInstance();
      cipher3.init(XMLCipher.DECRYPT_MODE, key);
            dd = cipher3.doFinal(ed, ee);

            target = toString(dd);

      Assert.assertEquals(source, target);
    }
View Full Code Here


  XMLCipher dataCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
  dataCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);

  for (int i = 0; i < dataToEncrypt.getLength(); i++) {
          dataCipher.doFinal(doc,(Element) dataToEncrypt.item(i), true);
  }

  // Check that user content has been removed
  Element user = (Element) dataToEncrypt.item(0);
        Node child = user.getFirstChild();
View Full Code Here

  XMLCipher dataCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
  dataCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);

  for (int i = 0; i < dataToEncrypt.getLength(); i++) {
          dataCipher.doFinal(doc,(Element) dataToEncrypt.item(i), true);
  }

  // Check that user content has been removed
  Element user = (Element) dataToEncrypt.item(0);
        Node child = user.getFirstChild();
View Full Code Here

      }

      // Create a new cipher just to be paranoid
      XMLCipher cipher3 = XMLCipher.getInstance();
      cipher3.init(XMLCipher.DECRYPT_MODE, key);
            dd = cipher3.doFinal(ed, ee);

            target = toString(dd);

      Assert.assertEquals(source, target);
    }
View Full Code Here

        }
       
        Node previousSibling = elem.getPreviousSibling();
        Node parent = elem.getParentNode();
        try {
            xmlCipher.doFinal(elem.getOwnerDocument(), elem, false);
        } catch (Exception e) {
            throw new WSSecurityException(
                WSSecurityException.FAILED_CHECK, null, null, e
            );
        }
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_ENCRYPTION, null, null, e2
                );
            }
View Full Code Here

                   
                    xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
                    EncryptedData encData = xmlCipher.getEncryptedData();
                    encData.setId(xencEncryptedDataId);
                    encData.setKeyInfo(keyInfo);
                    xmlCipher.doFinal(doc, body, content);
                   
                    Element encDataElem =
                        WSSecurityUtil.findElementById(
                            document.getDocumentElement(), xencEncryptedDataId, null
                        );
View Full Code Here

                } 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 xmlCipher = XMLCipher.getInstance(xmlCipherAlgorithm);
        xmlCipher.init(XMLCipher.ENCRYPT_MODE, dataEncryptionkey);

        if (secureTag.equalsIgnoreCase("")) {
            embedKeyInfoInEncryptedData(document, keyCipher, xmlCipher, dataEncryptionkey);
            document = xmlCipher.doFinal(document, document.getDocumentElement());
        } else {
            NodeIterator iter = XPathAPI.selectNodeIterator(document, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
                embedKeyInfoInEncryptedData(document, keyCipher, xmlCipher, dataEncryptionkey);
View Full Code Here

        } else {
            NodeIterator iter = XPathAPI.selectNodeIterator(document, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
                embedKeyInfoInEncryptedData(document, keyCipher, xmlCipher, dataEncryptionkey);
                Document temp = xmlCipher.doFinal(document, (Element) node, getSecureTagContents());
                document.importNode(temp.getDocumentElement().cloneNode(true), true);
            }
        }

        try {
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.