Examples of decryptToByteArray()


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

    Key key = findKey(encryptedData);
   
    cipher.init(XMLCipher.DECRYPT_MODE, key);
              
    byte[] dd = cipher.decryptToByteArray(ee);

    return dd;
     
    }
View Full Code Here

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

      XMLCipher cipherDecrypt = XMLCipher.getInstance();
      Key key =
        new SecretKeySpec("abcdefghijklmnop".getBytes("ASCII"), "AES");

      cipherDecrypt.init(XMLCipher.DECRYPT_MODE, key);
      byte[] decryptBytes = cipherDecrypt.decryptToByteArray(ee);

      Assert.assertEquals(new String(decryptBytes, "ASCII"),
                new String("A test encrypted secret"));
    }
    else {
View Full Code Here

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

      XMLCipher cipherDecrypt = XMLCipher.getInstance();
      Key key =
        new SecretKeySpec("abcdefghijklmnop".getBytes("ASCII"), "AES");

      cipherDecrypt.init(XMLCipher.DECRYPT_MODE, key);
      byte[] decryptBytes = cipherDecrypt.decryptToByteArray(ee);

      Assert.assertEquals(new String(decryptBytes, "ASCII"),
                new String("A test encrypted secret"));
    }
    else {
View Full Code Here

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

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

  // test with null type
        encryptedData = cipher.encryptData
View Full Code Here

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

                                    String symEncAlgo) throws WSSecurityException {
        SecretKey key = WSSecurityUtil.prepareSecretKey(symEncAlgo, secretKeyBytes);
        try {
            XMLCipher xmlCipher =
                EncryptionUtils.initXMLCipher(symEncAlgo, XMLCipher.DECRYPT_MODE, key);
            return xmlCipher.decryptToByteArray(root);
        } catch (XMLEncryptionException ex) {
            throw new WSSecurityException(
                WSSecurityException.UNSUPPORTED_ALGORITHM, null, null, ex
            );
        }
View Full Code Here

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

            throw new DecryptionException("Error initialzing cipher instance on data decryption", e);
        }

        byte[] bytes = null;
        try {
            bytes = xmlCipher.decryptToByteArray(targetElement);
        } catch (XMLEncryptionException e) {
            log.error("Error decrypting the encrypted data element", e);
            throw new DecryptionException("Error decrypting the encrypted data element", e);
        } catch (Exception e) {
            // Catch anything else, esp. unchecked RuntimeException, and convert to our checked type.
View Full Code Here

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

            throw new DecryptionException("Error initialzing cipher instance on data decryption", e);
        }

        byte[] bytes = null;
        try {
            bytes = xmlCipher.decryptToByteArray(targetElement);
        } catch (XMLEncryptionException e) {
            log.error("Error decrypting the encrypted data element", e);
            throw new DecryptionException("Error decrypting the encrypted data element", e);
        }
        if (bytes == null) {
View Full Code Here

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

        EncryptedData encryptedData = cipher.loadEncryptedData(doc, ee);

        Key key = findKey(encryptedData);
        cipher.init(XMLCipher.DECRYPT_MODE, key);

        return cipher.decryptToByteArray(ee);
    }

    /**
     * Method mapKeyName
     *
 
View Full Code Here

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

            // Now the decrypt, with a brand new cipher
            XMLCipher cipherDecrypt = XMLCipher.getInstance();
            Key key = new SecretKeySpec("abcdefghijklmnop".getBytes("ASCII"), "AES");

            cipherDecrypt.init(XMLCipher.DECRYPT_MODE, key);
            byte[] decryptBytes = cipherDecrypt.decryptToByteArray(ee);

            assertEquals("A test encrypted secret",
                        new String(decryptBytes, "ASCII"));
        } else {
            log.warn(
View Full Code Here

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

        //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
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.