Examples of decryptToByteArray()


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

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

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

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

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

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

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

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

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

            assert (new String(decryptBytes, "ASCII")).equals(
                new String("A test encrypted secret"));
        } else {
            log.warn(
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.