Comments (13)
Yes sure, here it is:
E/flutter (12905): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: RangeError (count): Invalid value: Not greater than or equal to 0: -5381629408123551712
E/flutter (12905): #0 RangeError.checkNotNegative (dart:core/errors.dart:356:7)
E/flutter (12905): #1 new SodiumPointer.alloc
package:sodium/…/bindings/sodium_pointer.dart:58
E/flutter (12905): #2 new SecureKeyFFI.alloc
package:sodium/…/api/secure_key_ffi.dart:30
E/flutter (12905): #3 KeygenMixin.keygenImpl
package:sodium/…/helpers/keygen_mixin.dart:21
E/flutter (12905): #4 SecretBoxFFI.keygen
package:sodium/…/api/secret_box_ffi.dart:32
E/flutter (12905): #5 EncryptionV2Service.generateKey
(Last line is my function that includes the keygen()
command.
Thanks for your help!
from libsodium_dart_bindings.
Interesting. I have an idea where this could come from, but am not quite sure yet. Could you give me a stack trace? Specifically the parts regarding libsodium are important for me.
from libsodium_dart_bindings.
Could you please add the following to your code, right before the SecretBoxFFI.keygen
method and send me the result?
print(mySecretBox.keyBytes)
I cannot test on Android myself for the next few days, so that would help me working on this earlier.
from libsodium_dart_bindings.
Also, which Android version and Architecture are you testing on
from libsodium_dart_bindings.
I cannot reproduce your issue on my arm x64 device. I think I need more details about the exact device you are testing on
from libsodium_dart_bindings.
Sorry for being late - I'm developing my app on an Android Emulator with API 30.
The specs are:
Name: Pixel_3a_API_30_x86_1
CPU/ABI: Google APIs Intel Atom (x86)
Target: google_apis [Google APIs] (API level 30)
Skin: pixel_3a
SD Card: 800 MB
fastboot.chosenSnapshotFile:
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: pixel_3a
hw.lcd.width: 1080
hw.initialOrientation: Portrait
image.androidVersion.api: 30
tag.id: google_apis
hw.mainKeys: no
hw.camera.front: emulated
avd.ini.displayname: Pixel_3a_API_30_x86_1
hw.gpu.mode: auto
hw.ramSize: 1536
PlayStore.enabled: false
fastboot.forceColdBoot: no
hw.cpu.ncore: 4
hw.keyboard: yes
hw.sensors.proximity: yes
hw.dPad: no
hw.lcd.height: 2220
vm.heapSize: 256
skin.dynamic: yes
hw.device.manufacturer: Google
hw.gps: yes
hw.audioInput: yes
image.sysdir.1: system-images/android-30/google_apis/x86/
showDeviceFrame: yes
hw.camera.back: virtualscene
AvdId: Pixel_3a_API_30_x86_1
hw.lcd.density: 440
hw.arc: false
fastboot.forceChosenSnapshotBoot: no
fastboot.forceFastBoot: yes
hw.trackBall: no
hw.battery: yes
hw.sdCard: yes
tag.display: Google APIs
runtime.network.latency: none
disk.dataPartition.size: 6G
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes
I will have a chance to give you the keybytes output in the next days (maybe on the weekend).
from libsodium_dart_bindings.
I can confirm this happening and I do know why. The native C-Bindings for libsodium have been generated on a x64 machine, with size_t beeing resolved to UInt64. This of course does not work on a 32 bit system. For know, the easiest way around this is to create yourself a 64 bit emulator.
Regarding deployment to actuald devices, arm64 and intel x64 devices are fine, but older armv7 devices would not work. I will try to find a way around this issue
from libsodium_dart_bindings.
I was able to confirm this. When I replace the "size_t" typedef in the generated bindings with "Uint32", the library works! Know I need to find a way to get the correct bindings based on architecture (which is not as easy as it sounds, as dart typically does not provide this information)
from libsodium_dart_bindings.
Okay so I manage to get it to work by enforcing "size_t" to be interpreted as "IntPtr" - this works in regards of sizing, as for all supported system IntPtr has the same size as size_t, however, this messes up signed-ness, as IntPtr is signed, while size_t is not. I fixed things up so all test should succeed, but I have to walk through the whole library again to ensure all sizes are correctly interpreted.
However, the current status should already be good enough to test out if it works for you as well, so if you have the time, please check out the latest master of sodium
and overwrite it in your pubspec.
from libsodium_dart_bindings.
Thanks a lot for your effort and your work - I really appreciate your help! I will have a chance to test next week and will provide feedback.
from libsodium_dart_bindings.
I assume everything worked? If not, please reopen
from libsodium_dart_bindings.
Sorry, forgot to answer - yes, everything works! Thanks for your effort. I was just curious, if you also implemented the helper methods for conversion, like bin2hex and hex2bin etc.?
from libsodium_dart_bindings.
No, i did not implement the helpers, as dart itself provides similar functions, which are much more efficient as no conversion between dart and the native code is required
from libsodium_dart_bindings.
Related Issues (20)
- iOS: Failed to lookup symbol 'sodium_init' HOT 5
- SecretStream Push Decryption HOT 1
- [sodium_libs] `LateInitializationError` if initialize in `compute` Isolate. How to use package with `compute` correctly?
- please update ffi HOT 2
- sodium.js - Cannot read properties of undefined (reading 'then') HOT 5
- Speed of sodium.crypto.secretBox.easy() etc... HOT 4
- Implement crypto_stream_xchacha20 HOT 1
- FFI failure or SodiumInit timing problem? HOT 9
- Flutter_test Failed to lookup symbol 'sodium_init' HOT 9
- Create `Sodium.runIsolated` method to easily run computation heavy cryptographic operations in an isolate HOT 12
- How does one use AES-GCM? HOT 12
- Request for SecretStream encryption/decryption example HOT 7
- Sodium.runIsolated breaking flutter run build HOT 2
- build failure: libsodium.so not found on latest update HOT 4
- Implement cryptoSignEd25519SkToSeed (crypto_sign_ed25519_sk_to_seed) HOT 8
- Use chacha20poly1305 instead of xchacha20poly1305_ietf HOT 2
- Secret stream state initialization; Continue interrupted upload of encrypted stream; HOT 3
- How update flutter_sodium 0.2.0 to sodium_libs? HOT 3
- How to create a shared secret using Scalarmult? HOT 6
- Fails to build on Fedora HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsodium_dart_bindings.