B4J Question AsyncStreams & encryption

wl

Well-Known Member
Licensed User
Longtime User
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:

B4X:
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
Upvote 0
Top