public static void encrypt(final byte[] data, final String password, final String originImagePath, final boolean useOTP, final String otpImagePath, final String targetImagePath, final IDECoderInterface coderInterface) {
        Thread t = new Thread() {

            @Override
            public void run() {
                String error = "";
                boolean success = false;
                try {
                    File originImage = new File(originImagePath);
                    File targetImage = new File(targetImagePath);
                    String dir = targetImage.getAbsoluteFile().toString();
                    dir = dir.substring(0, dir.lastIndexOf("/") + 1);
                    File targetImageDir = new File(dir);
                    if (originImage.exists() && originImage.canRead() && targetImageDir.exists() && targetImageDir.canWrite()) {
                        BufferedImage origin = ImageIO.read(originImage);
                        BufferedImage otp = null;
                        if (useOTP) {
                            otp = ImageIO.read(new File(otpImagePath));
                        }
                        BufferedImage code = codeData(data, password, origin, otp);
                        ImageIO.write(code, "PNG", targetImage);
                        success = true;
                    }
                } catch (Exception ex) {
                    error = ex.getMessage();
                    success = false;
                }
                if (success) {
                    coderInterface.dataSuccessfullyEncrypted(targetImagePath);
                } else {
                    coderInterface.encryptionError(targetImagePath, error);
                }
            }
        };
        t.start();
    }