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

Key Refresh Procedure #314

Merged
merged 6 commits into from
Jan 28, 2021
Merged

Key Refresh Procedure #314

merged 6 commits into from
Jan 28, 2021

Conversation

philips77
Copy link
Member

@philips77 philips77 commented Jan 26, 2021

This PR implements the Key Refresh Procedure.

Basic workflow is complete. There is no UI for this feature in the Sample app, but required messages are supported in the library. To update a Network Key and optionally bound Application Keys do the following:

  1. Initially, assume number of devices in the network, including the phone acting as Provisioner.
  2. All Nodes know Primary Network Key with 2 bound Application Keys.
  3. One of the devices was disposed, and to make it the proper way, all other devices need to update the Network Key to a different one, so the disposed one can no longer send or receive messages. The disposed device will be excluded from the Key Refresh Procedure.
  4. Mark the required device "Excluded" (former Blacklisted).
    /// The flag is set to `true` when the Node is in the process of being
    /// deleted and is excluded from the new network key distribution
    /// during the key refresh procedure; otherwise is set to `false`.
    public var isExcluded: Bool = false {
  5. Generate a new 16-byte key.
  6. Send ConfigNetKeyUpdate message to all non-excluded Nodes, including the local Node (phone). This step will distribute the new key to all Nodes. They will all go to Phase 1 of Key Refresh Procedure, also called Key Distribution.
  7. In that phase they will continue to send messages using the old key, but will decode messages secured using the old or the new Network Key.
  8. You may optionally send ConfigAppKeyUpdate to the same set of Nodes to update the Application Key(s). Mind, that updating Application Keys is only possible if the bound Network Key is in Phase 1.
  9. When all Nodes, including low-power Nodes received the new Network Key (and optionally Application Key) (which may take some time if low-power Nodes turn on rarely), send ConfigKeyRefreshPhaseSet with transition set to .finalize to the same set of Nodes. This will transition them to Phase 2 of Key Refresh Procedure, also called "Finalizing". In that phase they will start encrypting message using the new keys, and continue to receive messages (other than Secure Network beacons) using both old or new keys.

    Note: Sending Secure Network beacon is currently not supported and may be added in the future releases.

  10. When all Nodes are in Phase 2, the old keys can be revoked. Do this by sending ConfigKeyRefreshPhaseSet with transition set to .revokeOldKeys to all Nodes. This will make them forget the old keys and transition to the Phase 0 (Normal Operation).

Remember, that all messages in the iOS version of nRF Mesh library must be sent also to the local Node.

@philips77 philips77 marked this pull request as ready for review January 28, 2021 20:20
@philips77 philips77 merged commit 0da568b into develop Jan 28, 2021
@philips77 philips77 deleted the feature/key-refresh-proc branch January 28, 2021 20:55
@philips77 philips77 mentioned this pull request Jan 28, 2021
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.

1 participant