} else if (algorithm.startsWith("DESede")) {
//requires at least 192 bits (24 bytes)
KeySpec keySpec = new DESedeKeySpec(keyBytes);
key = SecretKeyFactory.getInstance("DESede").generateSecret(keySpec);
} else if (algorithm.startsWith("DES")) {
KeySpec keySpec = new DESKeySpec(keyBytes);
key = SecretKeyFactory.getInstance("DES").generateSecret(keySpec);
} else if (algorithm.startsWith("PBEWith")) {
paramSpec = new PBEParameterSpec(salt, iterationCount);
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
key = SecretKeyFactory.getInstance(keyAlgorithm).generateSecret(keySpec);