Convert python script to microflow

Hello everyone, I want to convert this code part from python, into a microflow.   cipher =, AES.MODE_CBC, iv.encode()) ciphertext = cipher.encrypt(pad(request_param_json.encode("utf-8"), AES.block_size))   How to do it with microflow?
1 answers

Hi Fadil,

Three ways come to my mind:

1-Use Encryption module and read this

2- Create a custom Java action which does the same 

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

public class EncryptionHelper {

    public static String encrypt(String plainText, String key, String iv) throws Exception {
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
        IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes("UTF-8"));

        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);

        byte[] encrypted = cipher.doFinal(plainText.getBytes("UTF-8"));
        return new String(Base64.getEncoder().encode(encrypted));

3- If you know any external service can do this thing you might use REST Service to achieve that