Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dc/237 encrypt large file #238

Merged
merged 8 commits into from
Dec 17, 2024
Merged

dc/237 encrypt large file #238

merged 8 commits into from
Dec 17, 2024

Conversation

cdawei
Copy link
Collaborator

@cdawei cdawei commented Dec 10, 2024

Pull Request Details

What issue does this PR address

Checklist

Complete the check-list below to ensure your branch is ready for PR.

Flutter Style Guide: https://survivor.togaware.com/gnulinux/flutter-style.html

  • Screenshots included in linked issue
  • Changes adhere to the team style and coding guideline
  • No confidential information
  • No duplicated content
  • No lint check errors related to your changes (make prep or flutter analyze lib)
  • Pre-exisiting lint errors noted: [HERE]
  • Tested on at least one device
    • Android Phone
    • Android Emulator
    • Chrome on Android
    • Chrome
    • iOS
    • Linux
    • MacOS
    • Windows
  • Added 2 reviewers (or 1 for private repositories then they add another)

Finalising

Once PR discussion is complete and 2 reviewers have approved:

  • Merge dev into the branch
  • Resolve any conflicts
  • Add one line summary into CHANGELOG.md
  • Bump appropriate version number in pubspec.yaml
  • Push to git repository and review
  • Merge PR into dev

@cdawei
Copy link
Collaborator Author

cdawei commented Dec 10, 2024

Please use the same test as shown in #186

Note that:

  • Chunks of the large file is now encrypted using AES, the encryption key and IV is stored in exampleApp/data/large_file.bin.ttl
  • The content of exampleApp/data/large_file.bin.ttl is also encrypted, its encryption key (encrypted using master key) and IV is stored in exampleApp/encryption/ind-keys.ttl

@anushkavidanage
Copy link
Collaborator

Thanks Dawei. Works great in Windows. One thing I noticed is that for Android the download function does not work. Uploading and deleting works for Android. We might need another task to tackle this.

@anushkavidanage
Copy link
Collaborator

Error I am getting.

D/AndroidRuntime( 5479): Shutting down VM
E/AndroidRuntime( 5479): FATAL EXCEPTION: main
E/AndroidRuntime( 5479): Process: com.togaware.demopod, PID: 5479
E/AndroidRuntime( 5479): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=55226, result=-1, data=Intent { dat=content://com.android.externalstorage.documents/... flg=0x43 }} to activity {com.togaware.demopod/com.togaware.demopod.MainActivity}: java.lang.NullPointerException: Attempt to get length of null array
E/AndroidRuntime( 5479): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5654)
E/AndroidRuntime( 5479): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5693)
E/AndroidRuntime( 5479): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
E/AndroidRuntime( 5479): 	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
E/AndroidRuntime( 5479): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
E/AndroidRuntime( 5479): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
E/AndroidRuntime( 5479): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2547)
E/AndroidRuntime( 5479): 	at android.os.Handler.dispatchMessage(Handler.java:111)
E/AndroidRuntime( 5479): 	at android.os.Looper.loopOnce(Looper.java:242)
E/AndroidRuntime( 5479): 	at android.os.Looper.loop(Looper.java:362)
E/AndroidRuntime( 5479): 	at android.app.ActivityThread.main(ActivityThread.java:8393)
E/AndroidRuntime( 5479): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 5479): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime( 5479): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:992)
E/AndroidRuntime( 5479): Caused by: java.lang.NullPointerException: Attempt to get length of null array
E/AndroidRuntime( 5479): 	at java.io.FileOutputStream.write(FileOutputStream.java:384)
E/AndroidRuntime( 5479): 	at com.mr.flutter.plugin.filepicker.FilePickerDelegate.onActivityResult(FilePickerDelegate.java:96)
E/AndroidRuntime( 5479): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:774)
E/AndroidRuntime( 5479): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:422)
E/AndroidRuntime( 5479): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:964)
E/AndroidRuntime( 5479): 	at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:911)
E/AndroidRuntime( 5479): 	at android.app.Activity.dispatchActivityResult(Activity.java:9086)
E/AndroidRuntime( 5479): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5647)
E/AndroidRuntime( 5479): 	... 13 more
I/Process ( 5479): Sending signal. PID: 5479 SIG: 9

@cdawei
Copy link
Collaborator Author

cdawei commented Dec 11, 2024

Thanks Dawei. Works great in Windows. One thing I noticed is that for Android the download function does not work. Uploading and deleting works for Android. We might need another task to tackle this.

Thanks Anushka. I created a new issue #239 for this task.

@cdawei
Copy link
Collaborator Author

cdawei commented Dec 11, 2024

E/AndroidRuntime( 5479): at com.mr.flutter.plugin.filepicker.FilePickerDelegate.onActivityResult(FilePickerDelegate.java:96)

A similar issue was reported in the flutter_file_picker package github repository miguelpruivo/flutter_file_picker#1604
It seems the issue has been fixed in version 8.1.3 and demopod was using 8.0.0+1.

I've just updated demopod to use the latest flutter_file_picker (version 8.1.5). It would be great if @anushkavidanage could do another test on the android phone and see if the downloading works. Thanks.

@cdawei
Copy link
Collaborator Author

cdawei commented Dec 13, 2024

According to Anushka, when trying to built the demopod on Android, got the following error:

AppData\Local\Pub\Cache\hosted\pub.dev\file_picker-8.1.5\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:257: error: cannot find symbol
        if (registrar != null) {
            ^
  symbol:   variable registrar
  location: class FilePickerPlugin

AppData\Local\Pub\Cache\hosted\pub.dev\file_picker-8.1.5\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:260: error: cannot find symbol
            registrar.addActivityResultListener(this.delegate);
            ^
  symbol:   variable registrar
  location: class FilePickerPlugin
2 errors

It seems someone has reported this on GitHub here miguelpruivo/flutter_file_picker#1645
And a pull request to fix this issue is pending review by the flutter_file_picker package developers miguelpruivo/flutter_file_picker#1643

We may try this branch of the package for now and revert back to the official version once it fixes the issue.

@anushkavidanage
Copy link
Collaborator

Since we need to explore a bit more into this issue, I suggest we merge this, release a new version for solidpod and then work on this issue in another branch.

@cdawei cdawei merged commit afe6e69 into dev Dec 17, 2024
@cdawei cdawei deleted the dc/237_encrypt_large_file branch December 17, 2024 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants