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

Question - encryption options over GATT #8

Open
PhantomRay opened this issue Apr 10, 2022 · 3 comments
Open

Question - encryption options over GATT #8

PhantomRay opened this issue Apr 10, 2022 · 3 comments

Comments

@PhantomRay
Copy link

PhantomRay commented Apr 10, 2022

Hi @Emill
Now I have successfully implemented a Flutter mobile GATT client and ble-host GATT server. It works as expected and seems very stable. Thank you for the wonderful library.

In regards to security, anything I can do to encrypt the data packet? Any build-in capability I can use? Currently there is no paring needed, however when the client connects, it does send a auth token for the server to validate.

@Scoutzknifez
Copy link

Furthermore, an example using the "encryption" value for characteristic.readPerm would be amazing to see on the README.

I am trying to do some sort of security / encryption without pairing the devices.

@Emill
Copy link
Owner

Emill commented Apr 13, 2022

Hi. I'll see if I can add some more examples when I have time.

But basically BLE connections need to be paired/bonded in order to start encryption, otherwise the connection will be unencrypted.

Assuming you use this library as a peripheral and you use a smartphone as central, you can either just call https://developer.android.com/reference/android/bluetooth/BluetoothDevice#createBond() on Android, or send a "security request" from the peripheral as shown in the readme.

Another way to enforce encryption from the peripheral side is to add security levels to the characteristics, which usually causes centrals to automatically start the pairing process. This is the way Apple suggests people to do it for iOS. The readPerm and writePerm properties on characteristics can be used to achieve this.

The pairing flow with user passkey (if the peripheral has I/O capability) can be controlled in this library. See the readme under "Bonding" to configure it if you want to use something else than "Just Works".

@PhantomRay PhantomRay changed the title Question - encrytption options ver GATT Question - encryption options over GATT Apr 14, 2022
@PhantomRay
Copy link
Author

Thank you Emill.
I will try the second way.

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

No branches or pull requests

3 participants