/** * Crypts the given byte array * * @param input * byte array to be encrypted * @param mode * crypt mode * @return the input crypted. Null in case of an error * @throws GeneralSecurityException */ @Override protected byte[] crypt(final byte[] input, final int mode) throws GeneralSecurityException { SecretKey key = generateSecretKey(); AlgorithmParameterSpec spec = createParameterSpec(); Cipher ciph = createCipher(key, spec, mode); return ciph.doFinal(input); }