Perform calculation on encrypted numbers What i am trying to achieve ?

I am developing a carpooling solution powered by Blockchain and IOT. This one is supposed to be technically convenient and without compromising on the privacy part. Driver should be able to share his location on runtime. In order to remove the privacy issue i was wondering if this is possible :-


Driver has his private key on device and shares the location in encrypted format 
Passenger requests for ride and queries server with its own encrypted location
Now we have list of active rides encrypted locations and one passenger encrypted location 
Server performs haversine geolocation calculation over list of available active rides and figures out the best possible match along with the distance 


I want to know if this is possible and if there is any efficient library available 
Any other options to achieve the desired results are also welcome 

Thanks in advance
No, that can't be done. There is no way that "Server performs haversine geolocation calculation over list of available active rides and figures out the best possible match along with the distance" but can't find driver's locations.

Worse, even if the server is trusted to internally know the location data, if it puts no limit to creating fake users and telling them what's the closest user, that allows to extract the location of any real user with arbitrary precision, by dichotomic search. That argument can be used to derive a rigorous proof of the above impossibility (sketch: there's nothing to stop a rogue server to use whatever computation it can make without implementing the necessary limitations).

Additionally, there is a possible inconsistency in "Driver has his private key on device and shares the location in encrypted format": the two things have no clear relationship. Fact is, it is never useful to encrypt with one's own asymmetric key, for only self could decipher. Remotely similar possibilities making sense include


Driver signs his/her location using his/her private key; that does not make the location confidential.
Driver encrypts his/her location with the server's public key.
Driver encrypts his/her location with public keys of some other users.


Note: variants of the last two involve establishing a symmetric key using the driver's asymmetric key, and using the symmetric key for encryption (perhaps authenticated), but that makes no functional change.



In the trusted server scenario, it is possible that users sign their location data with their private key and encrypt it with the server's public key; that keeps the location data from directly leaking to other users, and makes it necessary to use complicity of registered users to find a user's location. Further, the ability of a registered user to submit wildly different locations in a short period of time can be limited by the server. That's clearly feasible, including replacing the server by some secure "black box"; an HSM could do that.

Using Fully Homomorphic Encryption, it is theoretically possible that a non-trusted entity performs the distance calculation (including haversine), and I'm ready to admit it is possible to find the identity of the closest neighbor in encrypted form. But I see little point in that, for in the end deciphering distance and identity requires a trusted party / private key. Also, I'm afraid that, if security is required, the best FHE has to offer now would make computations slow (unbearably so for the encrypted identity).