cipher.init(((mode == ENCRYPT_MODE) ? Cipher.ENCRYPT_MODE
: Cipher.DECRYPT_MODE),
keyspec, new IvParameterSpec(iv, 0, cipher.getBlockSize()));
} catch (NoSuchPaddingException nspe) {
log.error("Blowfish initialization failed", nspe);
throw new AlgorithmOperationException("No Padding not supported");
} catch (NoSuchAlgorithmException nsae) {
log.error("Blowfish initialization failed", nsae);
throw new AlgorithmOperationException("Algorithm not supported");
} catch (InvalidKeyException ike) {
log.error("Blowfish initialization failed", ike);
throw new AlgorithmOperationException("Invalid encryption key");
/*} catch (InvalidKeySpecException ispe) {
throw new AlgorithmOperationException("Invalid encryption key specification");*/
} catch (InvalidAlgorithmParameterException ape) {
log.error("Blowfish initialization failed", ape);
throw new AlgorithmOperationException("Invalid algorithm parameter");
}
}