Creating Encrypted Arrays

In order to create an encrypted array, you simply need to pass your secret key upon the array creation:

#include <tiledb/tiledb.h>

// Create config with encryption key
const char key[] = "0123456789abcdeF0123456789abcdeF";
tiledb_config_t* config;
tiledb_config_alloc(&config, &error);
tiledb_config_set(config, "sm.encryption_type", "AES_256_GCM", &error);
tiledb_config_set(config, "sm.encryption_key", key, &error);

// Create context
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(config, &ctx);

// ... create array schema

// Create the array 
tiledb_array_create(
      ctx,
      "<array_uri>",
      schema);

Last updated