Encrypt and Store a Treasure Map on the Cloud
Any Wolfram Language expression can be encrypted.
Generate a strong symmetric key derived from a secret password using the Blowfish method.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_32.png)
skeletonKey = GenerateSymmetricKey["Avast ye!", Method -> "Blowfish"]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_27.png)
Encrypt the location of the treasure, stored in a GeoMarker and visualized using GeoGraphics, using the generated key.
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_28.png)
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_34.png)
hiddenTreasure = Encrypt[skeletonKey, treasureMap]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_29.png)
Now that the data is safely encrypted using a local key, upload the map to the Wolfram Cloud.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_35.png)
stowed = CloudPut[hiddenTreasure]
In order to cover the tracks, discard the original map and key using Clear.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_36.png)
Clear[hiddenTreasure]
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_37.png)
Clear[skeletonKey]
Since the key was derived using a password, you can create a new key using the original input.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_38.png)
newKey = GenerateSymmetricKey["Avast ye!", Method -> "Blowfish"]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_31.png)
The new key can now be used to reference the cloud-deployed map.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_39.png)
reclaimedMap = Decrypt[newKey, CloudGet[stowed]]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_32.png)
Extract the location of the treasure.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_40.png)
treasureLocation = reclaimedMap[[3, 2]]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_33.png)
Ask for driving directions.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_41.png)
TravelDirections[{$GeoLocation, treasureLocation}]
![](assets.en/index.en/M_2.gif)
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_34.png)
As there is no driving route to the treasure, compute its distance using GeoDistance.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_42.png)
GeoDistance[$GeoLocation, treasureLocation]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_35.png)
Given the distance, locate the nearest airport to the treasure.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_43.png)
airport = First[GeoNearest["Airport", treasureLocation]]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_36.png)
The distance from that airport to the treasure.
![Click for copyable input](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/In_44.png)
GeoDistance[airport, treasureLocation]
![](assets.en/encrypt-and-store-a-treasure-map-on-the-cloud/O_37.png)