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);
#include <tiledb/tiledb>
using namespace tiledb;
// ... create array schema
const char encryption_key[] = "0123456789abcdeF0123456789abcdeF"
// Create the array
Array::create(
array_name,
"<array_uri>",
TILEDB_AES_256_GCM,
encryption_key,
(uint32_t)strlen(encryption_key));
import tiledb
import numpy as np
# ... create array schema
key = "0123456789abcdeF0123456789abcdeF"
# Create a dense array with a key
tiledb.DenseArray.create("<array_uri>", schema, key=key)
# Create a sparse array with a key
tiledb.SparseArray.create("<array_uri>", schema, key=key)
# shortcut: borrow schema from dense array
# could create new schema here too
sch <- schema(tiledb_dense(uridense))
# create encrypted array
tiledb:::libtiledb_array_create_with_key(uriec, sch@ptr, encryption_key)
// ... create array schema
String key = "0123456789abcdeF0123456789abcdeF";
// Create the array
Array.create("my_array",
schema,
TILEDB_AES_256_GCM,
key.getBytes(StandardCharsets.UTF_8));
// ... create context ctx
// ... create schema
var encryption_key = "0123456789abcdeF0123456789abcdeF"
// Create the array
array, err := tiledb.NewArray(ctx, "<array_uri>")
array.CreateWithKey(schema, tiledb.TILEDB_AES_256_GCM, encryption_key)