Writing Encrypted Arrays
To write to an encrypted array, you simply need to open it for writing using the encryption key you used to create it.
// ... create context ctx
// Open encrypted array for writing
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);
tiledb_array_t* array;
tiledb_array_alloc(ctx, "<array-uri>", &array);
tiledb_array_set_config(ctx, array, config);
tiledb_array_open(ctx, array, TILEDB_WRITE);
// ... create context ctx
// Open encrypted array for writing
const char key[] = "0123456789abcdeF0123456789abcdeF";
Array array(ctx,
"<array-uri>",
TILEDB_WRITE,
// Load all fragments available
TemporalPolicy(0, std::numeric_limits<uint64_t>::max()),
EncryptionAlgorithm(AESGCM, key));
key = "0123456789abcdeF0123456789abcdeF"
tiledb.SparseArray.create(array_name, schema, key=key)
with tiledb.SparseArray(array_name, 'w', key=key) as A:
# A[] = ...
with tiledb.open(array_name, key=key) as A:
# read A[...]
ctx <- tiledb_ctx()
arrptr <- tiledb:::libtiledb_array_open_with_key(ctx@ptr, uridensewkey,
"WRITE", encryption_key)
// ... create context ctx
// Open encrypted array for writing
String key = "0123456789abcdeF0123456789abcdeF";
Array array(ctx, "<array-uri>", TILEDB_WRITE, TILEDB_AES_256_GCM, key..getBytes(StandardCharsets.UTF_8));
// ... create context ctx
// The 256-bit encryption key, stored as a string for convenience.
var encryption_key = "0123456789abcdeF0123456789abcdeF"
// Open encrypted array for writing
array, _ := tiledb.NewArray(ctx, "<array-uri>")
array.CreateWithKey(schema, tiledb.TILEDB_AES_256_GCM, encryption_key)
Last updated