For starters, I have yet to find any good documentation regarding the Particle Photon’s SoftAP setup – such as the commands like configure-ap, device-id, scan-ap, etc. I’ve only found these commands by disecting the SoftAP.js
I am not using the SoftAP.js as I am using my own code from scratch.
Everything is working fine (public-key, scan-ap, etc), except when sending the configire-ap command, I get a error from the photon, error 1040. Which translates to -0x0410 =TROPICSSL_ERR_RSA_INVALID_PADDING
I am pretty certain the encryption is working as expected, but i am questioning the public-key’s length I am getting from the photon. It’s 588 characters long (hex format), which includes a bunch of padded zeros on the end. Shouldn’t this public-key be 256, 512, 1024, or 2048 long?
If the length is right – any other ideas what could be the issue?
The public key is a HEX representation of a DER-encoded PKCS1.5 key. The code you posted above there looks like you are trying to use the entire key as the exponent. What’s the reason for not using softap.js? Surely this wheel doesn’t need re-inventing?
SoftAp.js is Node based. I tried the browserify option, but still ran in to issues getting it to work on my system.
Also, SoftAp is way overly complex and overkill. It appears the encryption code included with SoftAp includes way more than what is really needed. And the browserify package is over a 1MB in size because of all of the Node baggage.
I’ll check in to the exponent/mod parsing and report back.
Thanks!