NordicPlayground / nrf5-sdk-for-eddystone

Example implementation of the Eddystone GATT Configuration Service for nRF5 devices.
46 stars 23 forks source link

NOTE!

__This repository will no longer be maintained as the nRF5 SDK for Eddystone is now part of nRF5 SDK version 13.0.0.__

The project is found in the folder examples/ble_peripheral/ble_app_eddystone

Note that this version only supports nRF52 support.

Experimental support for nRF51 is found in nRF5 SDK Version 12.2.0 A future 12.x release will add production quality support for nRF51 for Eddystone.

nRF5 SDK for Eddystone™

This is an example implementation of the Eddystone GATT Configuration Service for nRF52. Support for nRF51 is scheduled for a future release. The application is intended to be used together with the open source nRF Beacon for Eddystone Android App. It is recommended to read the official specification for Eddystone, an open beacon format from Google to get a thorough understanding. Go to Quick start if you want to experiment right away.

Eddystone logo

Table of contents

Release note

Introduction

The new Eddystone GATT Configuration Service enables simple configuration of beacons. The user can configure the beacon to broadcast all Eddystone frame types:

Currently the firmware has five available slots and each slot can be configured to any of the unique frame types. From the source code it is possible to increase or decrease the number of available slots.

In addition to the new Eddystone GATT Configuration Service there are also two new frame types aimed at secure use cases.

The new frame types are Eddystone-EID and Eddystone-eTLM. EID, or Ephemeral Identifier, is a secure version of UID. eTLM, or encrypted TLM, is a secure telemetry format and provides information on the health of a beacon.

Eddystone-EID and Eddystone-eTLM protect against spoofing, replay attacks and malicious asset tracking - which are known beacon vulnerabilities.

Spoofing

Impersonating Eddystone-EIDs is difficult since the advertising data is encrypted and regularly updated.

Replay Attacks

By randomizing and never sending the Unlock Key in clear text it is difficult to perform replay attacks with the new Eddystone GATT Configuration Service. The beacon creates a random challenge token every time a user tries to unlock it. The user then encrypts the Lock Key with the challenge token and sends the result to the beacon. The result will be different for every unlock and replay attacks are therefore impossible.

Malicious Asset Tracking

Eddystone-EIDs randomize the device ID of the beacon as well as the encrypted advertising data. Since there are no constant values to track it will be difficult if not impossible to track the location of a single beacon over any significant time period.

IMPORTANT In order to have all the security benefits of Eddystone-EID and Eddystone-eTLM refrain from configuring other non-secure frame types while broadcasting these secure frame types

Supported characteristics

The application supports all functionality of the Eddystone GATT Configuration Service except the advanced optional characteristics as displayed in the table below. The advanced characteristics will be implemented in a future release.

Characteristic Name Status
1 Broadcast Capabilities :white_check_mark:
2 Active Slot :white_check_mark:
3 Advertising Interval :white_check_mark:
4 Radio Tx Power :white_check_mark:
5 Advertised Tx Power (advanced)
6 Lock State :white_check_mark:
7 Unlock :white_check_mark:
8 Public ECDH Key :white_check_mark:
9 EID Identity Key :white_check_mark:
10 Read/Write ADV Slot :white_check_mark:
11 Factory Reset (advanced)
12 Remain Connectable (advanced)

Prerequisites

Software

The application might work with other versions of the SDK/Keil but some modification of the source code is likely required on your part. For a quick start on using Embedded Studio with nRF5 devices see: https://devzone.nordicsemi.com/blogs/845/segger-embedded-studio-cross-platform-ide-w-no-cod/.

Hardware

Known issues

How to install

Quick start

This is the recommended approach if you just want to get started quickly without building the project yourself.

Compile from source

Keil

SEGGER Embedded Studio

Debugging

How to use

After flashing the firmware to a nRF52 DK it will automatically start broadcasting a Eddystone-URL pointing to http://www.nordicsemi.com, with LED 1 blinking. In order to configure the beacon to broadcast a different URL or a different frame type it is necessary to put the DK in configuration mode by pressing Button 1 on the DK so it starts advertising in "Connectable Mode". After that, it can be connected to nRF Beacon for Eddystone app, which allows the writing of the Lock Key to the Unlock Characteristic.

Please note that after pressing Button 1, the DK will only broadcast in "Connectable Mode" for 1 minute. After which, you must press Button 1 again if you did not manage to connect in time with the App.

LED Indications:
LED No. LED State Beacon State
LED 1 Blinking Advertising
LED 2 On Connected to Central
LED 3 On Advertising in Connectable Mode

Detailed instructions on how to use the App is available in the nRF Beacon for Eddystone GitHub repository.

How it works

Modules

The firmware is mainly broken up in several modules that each handle specific functionalities required by the Eddystone specification.

Flash blocks arrangement
Block No. Data Type Corresponding Structure
0 Slot Configuration eddystone_flash_slot_config_t
1,2,3... Slot Configuration eddystone_flash_slot_config_t
APP_MAX_ADV_SLOTS - 1 Slot Configuration eddystone_flash_slot_config_t
APP_MAX_ADV_SLOTS Private ECDH Key 32 byte array
APP_MAX_ADV_SLOTS + 1 Public ECDH Key 32 byte array
APP_MAX_ADV_SLOTS + 2 Lock Key 16 byte array
APP_MAX_ADV_SLOTS + 3 Flash Flags eddystone_flash_flags_t

User Configs

Inside project\pca10040_s132\config you can find debug_config.h and eddystone_app_config.h which are useful for changing the debug and application behaviour respectively. Read the comments in those files for details.

Issues and support

This example application is provided as a firmware foundation for beacon providers or for users simply wanting to experiment with Eddystone. It is not part of the official nRF5 SDK and support is therefore limited. Expect limited follow-up of issues.

Third-party crypto libraries

The example application uses algorithms from the following third-party cryptographic libraries.

Library Algorithm License
uWeave AES-128-ECB Unlicense
Cifra AES-EAX Creative Commons 0 1.0
Cifra ECDH 25519 Creative Commons 0 1.0
RFC6234 HMAC-SHA256 Simplified BSD License

About

This application has been developed by the application team at Nordic Semiconductor as a demonstration of the Eddystone GATT Configuration Service. It has not necessarily been thoroughly tested, so there might be unknown issues. It is hence provided as-is, without any warranty. However, in the hope that it still may be useful also for others than the ones we initially wrote it for, we've chosen to distribute it here on GitHub. The application is built to be used with the official nRF5 SDK, that can be downloaded from http://developer.nordicsemi.com/.

Licenses

The nRF5 SDK for Eddystone licensing is split between the portion of the source code that originates from Nordic Semiconductor ASA and the portion that originates from third-parties.

Note: The crypto_libs folder is not included in this repository but is created by running the setup script.