Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Java/Kotlin example on how to encrypt the new lock key with the old one. #235

Open
LouisCAD opened this issue Dec 18, 2017 · 1 comment
Open

Comments

@LouisCAD
Copy link

LouisCAD commented Dec 18, 2017

Hi,
Here in the Eddystone configuration service page, there's mentions on the fact that the new lokc key shall be encrypted with the old one, but there's no example, and no mention of which padding to use.

Please, could you share a code snippet on how to generate the encrypted key using the old key and the desired new key in Java or Kotlin?

I don't want to try this without being certain, because if I fail, my beacon is bricked with a key I don't know.
FYI, the target use is an Android app

@adriancretu
Copy link

Take a look at the Eddystone GATT service implementation in my beacon advertiser library: The AES transformations for the lock key encrypt/decrypt is right there
There is no padding used because for a 16-byte message it would add an empty padding block at the end, making it a 32-byte encrypted message without much point (a potential attacker would probably already know the message is 16 bytes, checking some padding for decryption consistency is last of his worries). Speaking of this, there's no IV either, but I suspect encrypting the new lock key using the older lock key should always be a one-time op anyway ;) Good luck.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants