How to send Device's key to Private Server & vice-versa?

One other point I wanted to add to @rickkas7 excellent response: None of the Particle cloud crypto is unique. It just uses a standard crypto library in normal ways. The only impediment to you using that same library is that the functions are not brought into the hardware abstraction layer (HAL) that is the key to having small updates of user firmware without reflashing the entire Device OS every time. Basically you cannot link against the crypto functions without compiling a different way.

If you choose to build locally with gcc on your computer in monolithic mode, you can easy access the crypto library, but you are giving up on a number of great features that the Particle world brings such as small user flash updates and easy cloud reflashing.

So what you seem to want is possible but is way outside the mainstream so expect to do a lot of the work yourself.