W wl Well-Known Member Licensed User Longtime User Sep 28, 2020 #1 Hi, I'm trying to use the encryption library as found at: https://www.b4x.com/android/forum/threads/alice-aes-encryption.108364/#content which allows me to read from an inputstream and writed an encrypted outputstream. I'm using asyncstreams (from the B4JFTPServer) to read a provided upload of a potential large file, as in: Code: Copy Private Sub AStream_NewData (buffer() As Byte) Try FileOut.WriteBytes(buffer, 0, buffer.Length) Catch Log(LastException) Close End Try End Sub How would I be able to encrypt the provided buffer() which is provided block by block, without taking the entire uploaded file into memory or without saving the file unencrypted and then in a second phase to encrypt the entire file. Would I be able to pass the provided array of bytes block by block and feed it into the encryption stream ? Thanks
Hi, I'm trying to use the encryption library as found at: https://www.b4x.com/android/forum/threads/alice-aes-encryption.108364/#content which allows me to read from an inputstream and writed an encrypted outputstream. I'm using asyncstreams (from the B4JFTPServer) to read a provided upload of a potential large file, as in: Code: Copy Private Sub AStream_NewData (buffer() As Byte) Try FileOut.WriteBytes(buffer, 0, buffer.Length) Catch Log(LastException) Close End Try End Sub How would I be able to encrypt the provided buffer() which is provided block by block, without taking the entire uploaded file into memory or without saving the file unencrypted and then in a second phase to encrypt the entire file. Would I be able to pass the provided array of bytes block by block and feed it into the encryption stream ? Thanks
Erel B4X founder Staff member Licensed User Longtime User Sep 29, 2020 #2 Most probably no. It will be much simpler to save the complete file and then decrypt it. I've posted code that encrypts or decrypts very large files here: https://www.b4x.com/android/forum/t...encryption-and-decryption.114141/#post-713166 With non-trivial code, you can make it work with AsyncStreams + B4XBytesBuilder. Upvote 0
Most probably no. It will be much simpler to save the complete file and then decrypt it. I've posted code that encrypts or decrypts very large files here: https://www.b4x.com/android/forum/t...encryption-and-decryption.114141/#post-713166 With non-trivial code, you can make it work with AsyncStreams + B4XBytesBuilder.