Handshake failed: decryption failed when trying to create new acc on local cloud

Hello, i’m trying to setup localCloud and use it with my photon. I’m already done all the things, even connected my photon and get Core online! message, but I stuck with some basic. I can’t create an account in local cloud.
When i do particle setup -> create new account -> pass new login/password, i get en exception in particle-cli

{ Error: socket hang up
at createHangUpError (_http_client.js:254:15)
at Socket.socketOnEnd (_http_client.js:346:23)
at emitNone (events.js:91:20)
at Socket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ECONNRESET' }

and get an error in the server logs:

Handshake decryption error:  Error: error:0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error
at Error (native)
at Object.decrypt (/media/wawak/puko/PROG/WebstormProjects/brewskey/spark-server-str/js/node_modules/ursa/lib/ursa.js:358:33)
at Object.decrypt (/media/wawak/puko/PROG/WebstormProjects/brewskey/spark-server-str/js/node_modules/spark-protocol/lib/ICrypto.js:167:27)
at Object.read_coreid (/media/wawak/puko/PROG/WebstormProjects/brewskey/spark-server-str/js/node_modules/spark-protocol/lib/Handshake.js:347:35)
at Object._nextStep (/media/wawak/puko/PROG/WebstormProjects/brewskey/spark-server-str/js/node_modules/spark-protocol/lib/Handshake.js:189:22)
at /media/wawak/puko/PROG/WebstormProjects/brewskey/spark-server-str/js/node_modules/spark-protocol/lib/Handshake.js:173:49
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
1: Core disconnected: decryption failed { coreID: 'unknown', cache_key: '_1' }
Session ended for _1
Handshake failed:  decryption failed { ip: '::ffff:', cache_key: '_1', coreID: null }
Handshake failed:  read_coreid timed out { ip: '::ffff:', cache_key: '_1', coreID: null }

Could you explain what does this error mean and how to fix it? thanks for any help!

Hi @wakwak,

So the first error you posted indicates that it’s not able to open a connection to something. If that’s from the particle-cli then it’s possible the CLI isn’t configured to point at the local cloud? Check the CLI setup notes in the readme here ( https://github.com/spark/spark-server ).

The second error indicates a decryption error when a device is trying to connect to the server. It’s during the “read_coreid” step, so that indicates that your device doesn’t have the right server key for your local server. Try regenerating your key, or making sure you’ve copied the right key to your device in the right format.

I hope that helps!


1 Like

Hi, Dave. Thanks for your answer. To be clear that we are on the same page: under the device you mean my photon, right? if so, I have no issues related with it. I setup keys for it and when trying to connect it: it’s connected successfully, breathing cayan and in the local server logs I haven’t got any errors(only Core online! log message).

The errors appear when i’m trying to create a new account in local server via particle-cli. what I do step by step:

  1. `particle config local apiUrl http://:< my server port>
  2. particle config local - to switch to the local config
  3. particle setup
  4. create new account , pass login/password
    and after that I catch the decrypt error. Do I need to provide server keys to particle-cli somehow, too?

okey, i’ve got it. I provided socket port to particle-cll config, and server treats that connection as another device.

1 Like

nevermind, the apiUrl uses port 8080, the spark port is 5683

And I just read the other thread about the server being broken

Hi @nsrb,

I’m not aware of the local server being broken, can you tell me more or link to the thread?


Same problem here