NebraLtd / hm-diag

Helium Miner Diagnostics
https://nebra.io/hnt
MIT License
21 stars 24 forks source link

Creating digital signature on the devices for a secure channel #300

Open MuratUrsavas opened 2 years ago

MuratUrsavas commented 2 years ago

We will be creating a trusted chain between our services and devices via utilizing ATECC608B.

The tasks will be:

shawaj commented 2 years ago

@MuratUrsavas I don't think we need to generate a CSR or any kind of certificate.

The ECC key is already an asymmetric encryption key. We do not need to create a new one

Example code https://github.com/MicrochipTech/gcp-iot-core-examples

shawaj commented 2 years ago

This might also be helpful https://github.com/MicrochipTech/cryptoauthlib/tree/main

shawaj commented 2 years ago

Basically, all we need to do is store the public key of each device (i.e. the helium public key) in google iot core.

This can then be used to sign JWTs on the device and use these JWTs to authenticate to IoT core.

Alternatively, we could create another private key in another slot in the ECC, and a corresponding public key and then upload that to iot core - but this seems like overkill and way more cumbersome. As we already have the ECC public key being generated and sent to our dashboard during manufacturing.

Sources:

Others:

MuratUrsavas commented 2 years ago

@shawaj It's not just about encrypted line between the device and cloud. We need to make sure it is authentic and non-tampered. So this signature will include our authentication key and the rest of the details (CPUID, MAC's, SerialNum, eMMC/SDCARD serial, Concentrator Serial etc. All possible traceable unique numbers).

This way we will be able to track its integrity.

shawaj commented 2 years ago

@MuratUrsavas why do we need any of that?

Seems like major overkill.

We can already verify it is the device using the private/public key pair and signed transactions

The other stuff is superfluous and unnecessary

vpetersson commented 2 years ago

This barely adds any complexity. These are just meta field for when we create the certificate. We can basically just add whatever data we want, but the key generation process is basically identical.

MuratUrsavas commented 2 years ago

I agree with @vpetersson. We can't use the keys of the Helium Network. So we need to add our logic for creating Private / Public keys. If we do that, creating a CSR would be almost the same effort as creating a key pair. But it would add a lot of value via providing integrity validation and message authenticity.

vpetersson commented 2 years ago

@MuratUrsavas Since we're using self-singed keys, a CSR isn't really necessary (only really needed for a full PKI setup). However, I'm not sure exactly how this library works if we can just skip that (like you can with openssl).

shawaj commented 1 year ago

Not sure we really need this anymore - @KevinWassermann94 any thoughts?