Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: AESCrypt - Very slow file encryption

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Location
    Brazil, Sao Paulo, SP
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb AESCrypt - Very slow file encryption

    Dear, I'm using AESCrypt to keep the encrypted music and videos in my Player.

    I used the following function to encrypt all media directory

    	public static void encryptMusic(){
    		String args1[] = new String[4];
    		args1[0] = "e"; // encrypt
    		args1[1] = "pass";
    		AESCrypt aes;
     
    		File filecryptss = new File("/home/dinho/midiasOLD");
     
    		File fList[] = filecryptss.listFiles();
     
    		for ( int i = 0; i < fList.length; i++ ){
    			args1[2] = "/home/dinho/midiasOLD/" + fList[i].getName();
    			args1[3] = "/home/dinho/midias/" + fList[i].getName();;
    			try {
    				aes = new AESCrypt(false, args1[1]);
    				aes.criptografar(args1);
    			} catch (UnsupportedEncodingException e2) {
    				// TODO Auto-generated catch block
    				e2.printStackTrace();
    			} catch (GeneralSecurityException e2) {
    				// TODO Auto-generated catch block
    				e2.printStackTrace();
    			};
     
    			System.out.println("Arquivo criptografado: " + fList[i].getName()); 
    			System.out.println("Deletando arquivo: " + fList[i].getName() + "..."); 
    			fList[i].delete(); // deleto o arquivo para não ocupar espaço
     
    		}
     
    		System.exit(0);
     
    	}

    At run time, do the decryption putting a new file as tmp just to run.

    String args1[] = new String[4];
    args1[0] = "d"; // decrypt
    args1[1] = "pass";
    args1[2] = "/home/dinho/midias/video.avi";
    args1[3] = "/home/dinho/midias/tmp_video.avi";
    AESCrypt aes;
    try {
    aes = new AESCrypt(false, args1[1]);
    aes.criptografar(args1);
    } catch (UnsupportedEncodingException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    } catch (GeneralSecurityException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    };


    After running the tmp file, it is removed from the directory.

    The problem I face is that when selecting a video file, depending on size, can take up to one minute only to decrypt.

    The question is:
    Is there a way to decrypt without the need to create a new physical file?
    I'm at least on the right track or is there a better way to do this whole process?


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: AESCrypt - Very slow file encryption

    AESCrypt is a third-party library; found here: Using AES Crypt - Advanced File Encryption for Java
    Please always inform us of such facts in future posts.

    The answer is that it all depends on how the AESCrypt library is implemented. Does the library only work with temp files? or is that your own 'hack'?
    Decrypting large media files is never going to be instant really.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

Similar Threads

  1. Struts application - slow request processing
    By chinnu in forum Web Frameworks
    Replies: 2
    Last Post: December 13th, 2011, 09:38 AM
  2. Blackjack program runs excrutiatingly slow.
    By sina12345 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 10th, 2010, 04:55 AM
  3. slow motion replays of previous games
    By WhatIsJavaAnyhow in forum Java Theory & Questions
    Replies: 10
    Last Post: December 3rd, 2010, 03:45 PM
  4. Crawler is getting slow
    By manokrrish in forum Threads
    Replies: 3
    Last Post: October 18th, 2010, 09:24 AM
  5. Web Crawling is too Slow!
    By sankar236 in forum Java Networking
    Replies: 5
    Last Post: September 29th, 2010, 09:37 AM

Tags for this Thread