Quickstart: Local Key Generation

Sample Code

Find the finalized code for this quickstart on GitHub

Prerequisites

Setup

  1. Clone the repo containing this quickstart to a local folder on a Linux, Mac or Windows platform.
  2. Retrieve a token from the Qrypt Portal
  3. (Optional) Create an environment variable QRYPT_TOKEN for it. For simplicity, the commands below will be referencing a QRYPT_TOKEN environment variable but you can also just use the token direclty in the commands below.
  4. Download the Qrypt Security SDK for your platform.
  5. Inside the cloned repo, create a lib folder
  6. Extract the Qrypt Security SDK.
  7. Remane the extracted folder to “QryptSecurity”
  8. Move the new “QryptSecurity” folder into the lib folder

Expected Folder structure

KeyGenLocal
   /lib
       /QryptSecurity
           /bin (Windows)
           /include
           /lib
           /res (Windows)

Macos Security Warning

Mac users will need to allow use of the library in the Security & Privacy settings. This will be fixed in a future release.

Reference

https://support.apple.com/en-us/HT202491

Build

To change to the KeyGenLocal folder:

cd KeyGenLocal

To make a (debug) build:

./build.sh --build_type=Debug

To find the build folder (if it built successfully):

For linux/mac

ls -d build

For windows

ls -d build/Debug/

To see more build options:

./build.sh --help

Run

To change to the KeyGenLocal build folder:

For linux/mac

cd KeyGenLocal/build

for windows

cd KeyGenLocal/build/Debug

To create and dspaly the locally generated AES key:

./KeyGenLocal --token=${QRYPT_TOKEN}

Debug

If you open the folder KeyGenLocal In Visual Studio Code, you will find a debug setup for KeyGenLocal.