As I see it, you could do it 3 ways:
- Encrypt the file beforehand and then upload that encrypted file.
- As you mentioned, you could read the file in byte array and then encrypt that byte array and upload it using
UploadFromByteArray
method. - Similar to #2 but instead of uploading byte array, you could rely on streams and upload using
UploadFromStream
method.