4. GEOLOCATION AND PRIVACY
THE PROBLEM
• Option A: Client-side
• Download locations, boundaries, etc from server
• Calculate and display answer on client
• WEAK POINTS: big and/or precise data, proprietary data
• Option B: Server-side
• Request geolocation from client, send curated results back
• GOOD FOR: finding your election / census info, large datasets
• WEAK POINTS: client privacy
5. GEOLOCATION AND PRIVACY
THE PROBLEM
• Can cryptographers create a 3rd Option?
• Use location data while it’s encrypted?
• This is a real thing called
HOMOMORPHIC ENCRYPTION
6. WHAT IS IT?
HOMOMORPHIC ENCRYPTION
• Classic examples: preparing stock market trade, email search
• 1978: first descriptions of Partially Homomorphic Cryptosystems
• Possible to perform arithmetic (addition OR multiplication) without
decrypting numbers
• 2009: first fully homomorphic cryptosystem, logic gates and all
• Why not adopted?
• People are OK sharing data, especially if they trust the business
with their money
• Expensive computation
7. TREASURE HUNT / GEOCACHING
DESIGNING OUR APPLICATION
I THINK WE FOUND THE
TREASURE
I CAN’T REVEAL THE
WIN LOCATION
WHERE ARE YOU?
ARE THEY SHARING
COORDINATES YET?
8. CHOOSING A CRYPTO SYSTEM
DESIGNING OUR APPLICATION
• In 2016, I chose the Paillier Cryptosystem for its Python and
JavaScript libraries on GitHub
• Today you could use others, maybe fully homomorphic crypto, or
LLVM
• Some repos: github.com/herumi/she-wasm runs in Web Assembly,
npmjs.com/node-hcrypt uses multiple dependencies
• What can we do with encrypted numbers (only partial)?
• Add, subtract encrypted and unencrypted integers
• Multiply by a scalar (possible to do 3 * x or 3.4 * x, not x * x)
9. TREASURE HUNT / GEOCACHING
MAKING A QUERY
AM I AT THE TREASURE
LOCATION?
USE MY PUBLIC KEY PLZ
10. TREASURE HUNT / GEOCACHING
MAKING A QUERY
AM I AT THE TREASURE
LOCATION?
USE MY PUBLIC KEY PLZ
11. TREASURE HUNT / GEOCACHING
MAKING A QUERY
THIS IS A 617-DIGIT
NUMBER?
CAN I MAKE THE SAME
NUMBER WITH THE KEY?
HOW IS JS HANDLING
THIS?
?lat=
334929186824659570088956240923716238760800994667805442788673520118294180150644643
381967207187681554464332372510963979864847790343587245266235465304867215544715688
921741290819421613418053105615630758875242876898390072520726980577592396801906772
503951322428823421599515309472549340891752671365791705009682700960223834685612196
395234303221211080941509336500833870037908354224796209283557329897768256335807645
508672594555757229814833194160222178258491169630143379272546672239151386540802843
554880083749678774495552354955392967608923260877514999030243487418576175871511185
00897064210692720802063451090155868802184986376384
12. TREASURE HUNT / GEOCACHING
MAKING A QUERY
I DO THE MATH
ONLY YOU WILL
BE ABLE TO DECRYPT
THE RESULT
* 10
* 10
* 10
* 10
13. TREASURE HUNT / GEOCACHING
MAKING A QUERY
OOPS
Parsing the response:
14. TREASURE HUNT / GEOCACHING
MAKING A QUERY
I HACKED THE SERVER LOGS
AND DB, BUT THEY NEVER
KNEW WHERE THE PLAYER
WAS
DID YOU GET ANYTHING?
15. NOT SO CLEAN
JUPYTER NOTEBOOKS
bit.ly/cryptogeo
github.com/Georeactor/crypto-geofence
18. NEARBY LOCATIONS
NEXT CHALLENGE
• Why this is hard (mathematically)
• If a server CAN sort by distance, it can test unlimited locations
• If a server CAN’T sort by distance, how does it limit response to
client?
• If the client receives distances and IDs, they can calculate all of
the locations from 3 different queries
19. NEARBY BUSINESSES
NEXT CHALLENGE
• Explaining our geohash: 9qqj7nsrzttj
• 26 letters + 10 numbers divide world into (6 x 6) parts, n times
• Send a square (using my level of precision n1) and receive
results organized by server’s level of precision n2 >= n1
21. FUTURE STUFF
• Use multiple boxes and triangles to make Treasure Hunt
work on any shape?
• Research newer JS libraries to support more geo
calculations, joint server-client calculations?
• Lattice-based PQ Crypto, Voting
Thanks for listening! Talk to me IRL / Twitter / GitHub:
Nick Doiron - @mapmeld
bit.ly/cryptogeo
github.com/Georeactor/crypto-geofence