Problem with Binaryfile

Discussion in 'Questions (Windows Mobile)' started by Pim93, Feb 20, 2008.

  1. Pim93

    Pim93 New Member Licensed User

    I'm french and I speak just a little.
    Excuse my bad English.
    I want a soft for encrypte a texte file and I use the EncrypteFile .zip for to understand the process.
    I have a problem with binaryfile.dll
    after decrypt end modify when I encrypt, I have the message with line "c = reader.ReadBytes(data(),32768)"


    Thinks for you help
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post your code?
    I've just checked EncryptFile example and it works properly.
     
  3. Pim93

    Pim93 New Member Licensed User

    Think you
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    In line 68: data() = Crypto.Decrypt(PassPhrase,secret())
    The 'data' array changes its size.

    You can no longer assume that it is an array of 32768 bytes.
    Therefore you should redimension it in the beginning of EncryptFile sub by adding:
    Dim data(32768) As Byte

    BTW, EncryptFile can handle large files. In your case you could use a much simpler code, similar to this example: http://www.basic4ppc.com/help/crypto/index.html
     
Loading...