Package org.apache.xml.security.encryption

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


        //decrypt
        XMLCipher dcipher = XMLCipher.getInstance(XMLCipher.AES_128);
        dcipher.init(XMLCipher.DECRYPT_MODE, key);
        String algorithm = encryptedData.getEncryptionMethod().getAlgorithm();
        assertEquals(XMLCipher.AES_128, algorithm);
        byte[] bytes = dcipher.decryptToByteArray(dcipher.martial(encryptedData));
        String after = new String(bytes, "UTF-8");
        assertEquals(before, after);

        // test with null type
        encryptedData = cipher.encryptData(d, null, new ByteArrayInputStream(serialized));
View Full Code Here


        if (encryptedKeys == null) {
            encryptedKeys = new ArrayList<EncryptedKey>();
        }
        encryptedKeys.add(encryptedKey);
        XMLCipher cipher = XMLCipher.getInstance();
        this.constructionElement.appendChild(cipher.martial(encryptedKey));
    }

    /**
     * Method addUnknownElement
     *
 
View Full Code Here

        //decrypt
        XMLCipher dcipher = XMLCipher.getInstance(XMLCipher.AES_128);
        dcipher.init(XMLCipher.DECRYPT_MODE, key);
        String algorithm = encryptedData.getEncryptionMethod().getAlgorithm();
        assertEquals(XMLCipher.AES_128, algorithm);
        byte[] bytes = dcipher.decryptToByteArray(dcipher.martial(encryptedData));
        String after = new String(bytes, "UTF-8");
        assertEquals(before, after);

        // test with null type
        encryptedData = cipher.encryptData(d, null, new ByteArrayInputStream(serialized));
View Full Code Here

       
        assertEquals("#id10", keyRef10.getURI());

        // See SANTUARIO-302
        // https://issues.apache.org/jira/browse/SANTUARIO-302
        Element dataRefListElement = dataCipher.martial(doc, dataRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, dataRefListElement.getLocalName());
        Element dataRef1Element = (Element)dataRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef1Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef1Element.getLocalName());
View Full Code Here

        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef2Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef2Element.getLocalName());
        assertEquals("#id2", dataRef2Element.getAttribute("URI"));
        assertNull(dataRef2Element.getNextSibling());
       
        Element keyRefListElement = dataCipher.martial(doc, keyRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, keyRefListElement.getLocalName());
        Element keyRef10Element = (Element)keyRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRef10Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, keyRef10Element.getLocalName());
View Full Code Here

      key.setKeyInfo(keyInfo);

      key.setReferenceList(cipher.createReferenceList(org.apache.xml.security.encryption.ReferenceList.DATA_REFERENCE));
      list.populateRealReferenceList(key.getReferenceList());

      cachedElement = cipher.martial(key);
      return cachedElement;
   }

   public void addReference(String id)
   {
View Full Code Here

        if (encryptedKeys == null) {
            encryptedKeys = new ArrayList<EncryptedKey>();
        }
        encryptedKeys.add(encryptedKey);
        XMLCipher cipher = XMLCipher.getInstance();
        this.constructionElement.appendChild(cipher.martial(encryptedKey));
    }

    /**
     * Method addUnknownElement
     *
 
View Full Code Here

        //decrypt
        XMLCipher dcipher = XMLCipher.getInstance(XMLCipher.AES_128);
        dcipher.init(XMLCipher.DECRYPT_MODE, key);
        String algorithm = encryptedData.getEncryptionMethod().getAlgorithm();
        assert(XMLCipher.AES_128.equals(algorithm));
        byte[] bytes = dcipher.decryptToByteArray(dcipher.martial(encryptedData));
        String after = new String(bytes, "UTF-8");
        assert before.equals(after);

        // test with null type
        encryptedData = cipher.encryptData(d, null, new ByteArrayInputStream(serialized));
View Full Code Here

    throws XMLEncryptionException {
      if (encryptedKeys==null)
        encryptedKeys=new ArrayList();
      encryptedKeys.add(encryptedKey);
      XMLCipher cipher = XMLCipher.getInstance();
      this._constructionElement.appendChild(cipher.martial(encryptedKey));
  }

   /**
    * Method addUnknownElement
    *
 
View Full Code Here

        if (encryptedKeys == null) {
            encryptedKeys = new ArrayList<EncryptedKey>();
        }
        encryptedKeys.add(encryptedKey);
        XMLCipher cipher = XMLCipher.getInstance();
        appendSelf(cipher.martial(encryptedKey));
    }
   
    /**
     * Method addDEREncodedKeyValue
     *
 
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.