Hello, World! Encryption

The simplest way to get started with Evervault is by encrypting some data using the REST API. The REST API exposes several useful functions, two of which are encrypt and decrypt.

In this guide, we'll use these functions to encrypt and decrypt the value of a JSON object. We'll use cURL to send authenticated requests to the Evervault REST API, but you can use any HTTP client.

Encrypting Data

The encrypt endpoint in the Evervault REST API can be used to encrypt the values of JSON objects or files. The Evervault REST API is authenticated using HTTP basic authentication, where the credential is constructred by combining your App ID and a Scoped API Key. Both credentials can be found in the Evervault Dashboard.

When you create your Scoped API Key in the Evervault Dashboard, ensure that you have enabled Encrypt and Decrypt as permissions.

To demonstrate, we're going to use cURL to send an authenticated request to the encrypt endpoint.

If you run the snippet using your App ID and a Scoped API Key, the response should look something like this:

Decrypting Data

Next, we're going to use the decrypt endpoint to decrypt the encrypted value we received in the previous step. The decrypt endpoint in the Evervault REST API can be used to decrypt the values of JSON objects or files. Again, the request is authenticated using HTTP basic authentication, where the credential is constructed by combining your App ID and a Scoped API Key.

This time, we're going to use cURL to send an authenticated request to the decrypt endpoint. We'll use the encrypted value we received in the previous step as the value of the hello key in the request body.

This time, the response should look something like below, where the value of the hello key is the original value we encrypted in the first step: world.

Summary

In this guide, we used the Evervault REST API to encrypt and decrypt the value of a JSON object. This is the simplest way to get started with Evervault. In the other Encryption 101 guides, we'll explore different ways to use Evervault Primitives for more complex workflows.