Android中的视频解密问题

时间:2017-07-20 07:47:38

标签: java android encryption aes

我正在使用" AES"用于视频解密的算法,以加密格式存储在外部Sd卡上。解密视频时,其解密率仅为47%并停止。请给出解决方案

public void createDecryptedFile(File decryptedFileDir, File decryptedFile,
                                File encryptedFile) {
    try {
        if (!decryptedFileDir.exists()) {
            decryptedFileDir.mkdirs();
        }
        Cipher decipher;
        decryptedFile.createNewFile();
        deleteFile = decryptedFile;
                        FileInputStream encryptedFileInputstream = new FileInputStream(
                encryptedFile);
        FileOutputStream decryptedFileOutputstream = new FileOutputStream(
                decryptedFile);

        decipher = Cipher.getInstance("AES");
        Key key = generateKey();
        decipher.init(Cipher.DECRYPT_MODE, key);

        CipherOutputStream cos = new CipherOutputStream(
                decryptedFileOutputstream, decipher);

        byte data[] = new byte[10000 * 1024];

        int count;
        try {

            while ((count = encryptedFileInputstream.read(data)) != -1  && !stopConversion) {
                Log.d("#########", "##########");

                total += count;
                Log.e("convert count", total + "");

                cos.write(data, 0, count);

                final long l = encryptedFile.length();

                runOnUiThread(new Runnable() {
                    public void run() {

                        // Show percentage 
                        loadingpercent.setText("" + (int) (total * 100 / l) + "%");
                    }
                });

                Log.d("$$$$$$$$",""+encryptedFileInputstream.read(data));

            }

1 个答案:

答案 0 :(得分:0)

Invoke("Interface", 1f);