particle-iot / spark-server

UNMAINTAINED - An API compatible open source server for interacting with devices speaking the spark-protocol
https://www.particle.io/
GNU Affero General Public License v3.0
441 stars 136 forks source link

Photon handshake decryption error #83

Open jzellis opened 5 years ago

jzellis commented 5 years ago

So I'm getting this error whenever I try to create an account on the local server, after entering an email and password and password verification:

Connection from: ::ffff:192.168.0.14, connId: 1 Handshake decryption error: Error: error:0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error at Object.decrypt (/Users/jzellis/projects/photon/spark-server/node_modules/ursa/lib/ursa.js:358:33) at Object.decrypt (/Users/jzellis/projects/photon/spark-server/node_modules/spark-protocol/lib/ICrypto.js:167:27) at Handshake.read_coreid (/Users/jzellis/projects/photon/spark-server/node_modules/spark-protocol/lib/Handshake.js:347:35) at Handshake._nextStep (/Users/jzellis/projects/photon/spark-server/node_modules/spark-protocol/lib/Handshake.js:189:22) at /Users/jzellis/projects/photon/spark-server/node_modules/spark-protocol/lib/Handshake.js:173:49 at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) 1: Core disconnected: decryption failed { coreID: 'unknown', cache_key: '_0' } Session ended for _0 Handshake failed: decryption failed { ip: '::ffff:192.168.0.14', cache_key: '_0', coreID: null }

The cli shows this error:

{ Error: socket hang up at createHangUpError (_http_client.js:312:15) at Socket.socketOnEnd (_http_client.js:405:23) at Socket.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1091:14) at process._tickCallback (internal/process/next_tick.js:174:19) code: 'ECONNRESET' } ! Oops, that didn't seem to work. Let's try that again

I've followed the instructions for this repo (which should probably be updated to reflect the change from spark to particle btw), and I tracked down a few of the known errors and commented out the length check in Handshake.js, etc. But no go. particle-cli is definitely connecting to the server, it just doesn't seem to be handling the decryption properly.

Any thoughts? I really, really need to make this work. Thanks!