Problem with Binaryfile

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
 

Erel

B4X founder
Staff member
Licensed User
Longtime 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.b4x.com/help/crypto/index.html
 
Top