Problem registering keys with nRFcloud

I have a Thingy91 that I want to connect to nRFcloud.  Not knowing the state of its keys/provisioning I followed the procedure to generate just-in-time keys (as a first attempt).

I cleared the existing keys, generated keys using AT%KEYGEN, parsed the CBOR object into a CSR, created a Device Certificate and provisioned the device with nRFcloud.  I then used Link Monitor to load my own CA and the Amazon CA1 certificate into the modem (presumably the private key was stored when it was created?)

I then attempted to submit the public key to nRFcloud using this command:

curl -X POST https://api.nrfcloud.com/v1/devices/public-keys --data-binary \src\keys\register.csv -H "Content-Type: application/octet-stream" -H "Authorization: Bearer 3e....8f"

with this in register.csv:

nrf-351358811472304,"-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1NdDa66VcX1JBQ7sxDN98blYNQ3C
akfeB9B8Zpjft11E8WDhztDmnVgectG6Lk6Dg1KGCiRwfIV0s5FBsbzb6g==
-----END PUBLIC KEY-----
"


This was rejected with this message:


{"message":"A total of 1 value(s) failed validation while processing the CSV [failed row indices (1-based)]: {\"DeviceId\":[1]}. See the API docs for this endpoint to find the regex patterns for proper validation.","code":42200,"helpUrl":"">api.nrfcloud.com/.../


I can't see what's wrong though, can you advise please?

I've obfuscated by API key, but the content of register.csv is verbatim.

Thanks,

  Frog

  • I believe I've resolved this - I had copied and pasted the key into a Word document (documenting my work as I go).  I knew that Word has a tendency to replace double quotes with distinct 'open' and 'close' quotation marks, but I hadn't realised that it also replaces hyphens with another Unicode character that looks like a hyphen but isn't.  Replacing the 'en dash' or whatever Word decided to use with an ASCII 0x2d appears to resolve the problem.

Related