如何通过块解密视频文件并传递到视频视图?

时间:2017-07-24 08:48:24

标签: java android

这是我的代码,用于解密整个视频文件并将解密的视频文件路径传递给视频视图,以便如何通过块解密视频块并将其传递到视频视图,并在第一个块传递之后,第二个块将在后台解密并且在第二个块解密后将其传递给视频视图如何实现

try
{

    FileInputStream encfis = new FileInputStream(Encrypted_File_Path);
    FileOutputStream decfos = new FileOutputStream(Decrypted_File_Path);

    Cipher decipher = Cipher.getInstance("AES");

    String encode ="8888888888888888";
    byte[] decodedKey = encode.getBytes();
    SecretKey originalKey = new SecretKeySpec(decodedKey, 0, decodedKey.length, "AES");

    decipher.init(Cipher.DECRYPT_MODE, originalKey);
    CipherOutputStream cos = new CipherOutputStream(decfos,decipher);

    int c;
    byte[] d1 = new byte[4096 * 2048];
    while((c = encfis.read(d1)) != -1)
    {
        cos.write(d1, 0, c);
        cos.flush();
    }
    cos.close();
}
catch(Exception e)
{
    e.printStackTrace();
}

0 个答案:

没有答案