}
return secretKey;
}
private Key generateDataEncryptionKey() throws Exception {
KeyGenerator keyGenerator = null;
if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.TRIPLEDES)) {
keyGenerator = KeyGenerator.getInstance("DESede");
} else {
keyGenerator = KeyGenerator.getInstance("AES");
if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_128)
|| xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_128_GCM)
|| xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.SEED_128)
|| xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_128)) {
keyGenerator.init(128);
} else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_192)
|| xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_192_GCM)
|| xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_192)) {
keyGenerator.init(192);
} else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_256)
|| xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_256_GCM)
|| xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_256)) {
keyGenerator.init(256);
}
}
return keyGenerator.generateKey();
}