private byte[] transform(int cryptMode, byte[] value, byte[] salt, int iterations) throws Exception {
        checkPositive(iterations, "Count of iterations has to be positive number.");
        SecretKeyFactory factory = SecretKeyFactory.getInstance(secretKeyFactoryAlgorithm);
        char[] password = getPassword();
        checkTrue(password != null && password.length > 0, "Empty password is not supported");
        PBEKeySpec pbeKeySpec = new PBEKeySpec(password, salt, iterations, keyLengthBits);
        byte[] tmpKey = factory.generateSecret(pbeKeySpec).getEncoded();
        SecretKeySpec secretKeySpec = new SecretKeySpec(tmpKey, secretKeyAlgorithm);
        Cipher cipher = securityProvider == null ? Cipher.getInstance(cipherAlgorithm)
                : Cipher.getInstance(cipherAlgorithm, securityProvider);
        cipher.init(cryptMode, secretKeySpec);
        return cipher.doFinal(value);
    }
private byte [ ] transform ( int cryptMode , byte [ ] value , byte [ ] salt , int iterations ) throws Exception { checkPositive ( iterations , "Count of iterations has to be positive number." ) ; SecretKeyFactory factory = SecretKeyFactory . getInstance ( secretKeyFactoryAlgorithm ) ; char [ ] password = getPassword ( ) ; checkTrue ( password != null && password . length > 0 , "Empty password is not supported" ) ; PBEKeySpec pbeKeySpec = new PBEKeySpec ( password , salt , iterations , keyLengthBits ) ; byte [ ] tmpKey = factory . generateSecret ( pbeKeySpec ) . getEncoded ( ) ; SecretKeySpec secretKeySpec = new SecretKeySpec ( tmpKey , secretKeyAlgorithm ) ; Cipher cipher = securityProvider == null ? Cipher . getInstance ( cipherAlgorithm ) : Cipher . getInstance ( cipherAlgorithm , securityProvider ) ; cipher . init ( cryptMode , secretKeySpec ) ; return cipher . doFinal ( value ) ; }
Encrypt/decrypt given value by using the configured cipher algorithm with provided salt and iterations count.

@param cryptMode mode (one of {@link Cipher#DECRYPT_MODE}, {@link Cipher#ENCRYPT_MODE})
@param value value to encrypt/decrypt
@param salt salt to be used
@param iterations count of iterations
@return encrypted or decrypted byte array (depending on cryptMode)