Examples of decryptToByteArray()


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()

    ) 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);
        }
        if (bytes == null) {
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()

    ) throws WSSecurityException {
        SecretKey key = KeyUtils.prepareSecretKey(symEncAlgo, secretKeyBytes);
        try {
            XMLCipher xmlCipher =
                EncryptionUtils.initXMLCipher(symEncAlgo, XMLCipher.DECRYPT_MODE, key);
            return xmlCipher.decryptToByteArray(root);
        } catch (XMLEncryptionException ex) {
            throw new WSSecurityException(WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex);
        }
    }
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()

                                    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()

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