Encrypt / Decrypt a complete file

Discussion in 'Code Samples & Tips' started by Erel, Jun 4, 2007.

  1. Erel

    Erel Administrator Staff Member Licensed User

    This is an example of using the Crypto library (together with the BinaryFile library) to encrypt and later decrypt a complete file.
    You can use it to encrypt a file, send the encrypted file over an unsecured connection and then decrypt it.
     

    Attached Files:

  2. belotrei

    belotrei Member

    Very nice code! I've tried this and that's great..

    Can crypto control decrypt a file -on the fly-? So no need to always make a temporary one and then delete it after the application is closed. In my project I want to use the already encrypted sql database file, and then decrypt it just when the app read them. But don't want to make a temporary file, because there's always a possibility, while the file is not in the encrypted state, that file (temporary decrypted file) can be copied by user, and.. in that case, the protection is gone.

    One more question, Is the decryption process from files need high 'power' of pda's device? Because i don't want it slows down my app's performance.

    Thank you..
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can encrypt a complete file without using a temporary file as long as you have enough memory.
    You could just read the whole file to an array and then encrypt it.
    The decryption takes some time, you should test if it suits your needs.
     
  4. belotrei

    belotrei Member

    Thanks Erel. So the only thing to consider is the performance. I've tried the method at ipaq hx2750 a little bit slow. and at o2 atom exec slower than 2750. At rx3417 faster than atom exec but slower than 2750. At 1940 just 'like' stuck (too long for me)..
     
Loading...