Hi,
I am currently working on a project aimed at connecting an ESP32 powered system to the Google IoT Core. I am struggling to create the JWT signature and I really need help to understand how the ECDSA works. I looked for sample libraries but could not find one with a good example of how to use it; I am still new to the IoT thing but eager to learn.
I tried to use the Google IoT experimental version on my system but generated tokens with invalid signatures. I verified this using JWT.io. Note that I had to extract the parts I needed from the version shown in Github. I want to eventually use the HTTP bridge but would rather like to start from the beginning and get the JWT right before I even look at uploading to Google Cloud Platform.
Can anyone give me some help on generating a simple ECDSA signature to append to my token using the following private key example:
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEINsXv+nlVrKDSC2F78uvauGCQPA1wZerWDsJAJdAuPLqoAoGCCqGSM49
********************************==
-----END EC PRIVATE KEY-----
Please find attached my current arduino sketch with all the libraries I used.
Thanks in advance.
ecc.cpp (18.5 KB)
ecc.h (4.76 KB)
ecdsa.cpp (8.18 KB)
ecdsa.h (1.67 KB)
nn.cpp (17.7 KB)
nn.h (11.8 KB)
prng.cpp (1 KB)
prng.h (894 Bytes)
secp256r1.cpp (11.6 KB)
sha256.cpp (5.46 KB)
sha256.h (1.16 KB)