java - Encryption and decryption video -


i found code on internet , works on java, in android errors , don't understand it. have error of "error opening trace file: no such file or directory (2)". thankful if me!

public class mainactivity extends activity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_aeshelper);      button btn = (button) findviewbyid(r.id.button1);      final string filedir = "data/";       btn.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view arg0) {             try {                 fileinputstream fis = new fileinputstream(new file(filedir+"aaa.mp4"));                 file outfile = new file(filedir + "encryptedvideo.mp4");                 int read;                 if (!outfile.exists())                     outfile.createnewfile();                 file decfile = new file(filedir + "decryptedvideo.mp4");                 if (!decfile.exists())                     decfile.createnewfile();                 fileoutputstream fos = new fileoutputstream(outfile);                 fileinputstream encfis = new fileinputstream(outfile);                 fileoutputstream decfos = new fileoutputstream(decfile);                 cipher encipher = cipher.getinstance("aes");                 cipher decipher = cipher.getinstance("aes");                 keygenerator kgen = keygenerator.getinstance("aes");                  secretkey skey = kgen.generatekey();                 encipher.init(cipher.encrypt_mode, skey);                 cipherinputstream cis = new cipherinputstream(fis, encipher);                 decipher.init(cipher.decrypt_mode, skey);                 cipheroutputstream cos = new cipheroutputstream(decfos, decipher);                 while ((read = cis.read()) != -1) {                     fos.write((char) read);                     fos.flush();                 }                 fos.close();                 while ((read = encfis.read()) != -1) {                     cos.write(read);                     cos.flush();                 }                 cos.close();             } catch (exception e) {                 toast.maketext(getapplicationcontext(),"!!!",                             toast.length_long).show();               }         }      });     }    

}


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -