Reading Encrypted Arrays
To read from an encrypted array, you simply need to open it for reading using the encryption key you used to create it.
// ... create context ctx
// Open encrypted array for reading
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_READ);
// ... create context ctx
// Open encrypted array for reading
const char key[] = "0123456789abcdeF0123456789abcdeF";
Array array(ctx,
"<array-uri>",
TILEDB_READ,
// Load all fragments available
TemporalPolicy(0, std::numeric_limits<uint64_t>::max()),
EncryptionAlgorithm(AESGCM, key));
// Or, open at timestamp
uint64_t timestamp = 1561492235844; // In ms
Array array(ctx,
"<array-uri>",
TILEDB_READ,
TemporalPolicy(0, timestamp),
EncryptionAlgorithm(AESGCM, key));
# All array and schema opening APIs support `key` as an
# optional keyword argument to open encrypted arrays:
key = "0123456789abcdeF0123456789abcdeF"
tiledb.DenseArray(uri, key=key)
tiledb.SparseArray(uri, key=key)
tiledb.open(uri, key=key)
tiledb.ArraySchema.load(uri, key=key)
ctx <- tiledb_ctx()
arrptr <-
tiledb:::libtiledb_array_open_with_key(ctx@ptr, uridensewkey, "READ",
encryption_key)
# timestamps for TileDB are milliseconds since epoch, we use
# R Datime object to pass the value
tstamp <- as.POSIXct(1577955845.678, origin="1970-01-01")
arrptr <-
tiledb:::libtiledb_array_open_at_with_key(ctx@ptr, uridensewkey, "READ",
encryption_key, tstamp)
// ... create context ctx
// Open encrypted array for reading
String key = "0123456789abcdeF0123456789abcdeF";
Array array = new Array(ctx, "<array-uri>", TILEDB_READ, TILEDB_AES_256_GCM, key.getBytes(StandardCharsets.UTF_8));
// Or, open at timestamp
uint64_t timestamp = 1561492235844; // In ms
Array array = new Array(ctx, "<array-uri>", TILEDB_READ, TILEDB_AES_256_GCM, key.getBytes(StandardCharsets.UTF_8), timestamp);
// ... create context ctx
// Open encrypted array for reading
var encryption_key = "0123456789abcdeF0123456789abcdeF"
array, _ := tiledb.NewArray(ctx, "<array-uri>")
array.OpenWithKey(tiledb.TILEDB_READ, tiledb.TILEDB_AES_256_GCM, encryption_key)
// Or, open at timestamp
var timestamp uint64 = 1561492235844 // In ms
array.OpenAtWithKey(tiledb.TILEDB_READ, tiledb.TILEDB_AES_256_GCM, encryption_key, timestamp)
// ... create context ctx
// Open encrypted array for reading
string Key = "0123456789abcdeF0123456789abcdeF";
using Config config = new Config();
tiledb_config_t* config;
tiledb_config_alloc(&config, &error);
config.Set("sm.encryption_type", "AES_256_GCM");
config.Set("sm.encryption_key", key);
using Array array = new Array(ctx, "<array-uri>");
array.SetConfig(config);
array.Open(QueryType.Read);
Last updated