Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/sql/tpch/naive/sf1/load_sf1.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require tpch

# load the DB from disk
statement ok
ATTACH 'lorderkey_tpch_sf1_naive.db' AS encnaive;
ATTACH 'lship_tpch_sf1_naive.db' AS encnaive;

statement ok
CALL dbgen(sf=1);
Expand All @@ -25,6 +25,12 @@ CREATE SECRET key_2 (
LENGTH 16
);

statement ok
CREATE TABLE encnaive.lineitem AS
SELECT
encrypt_naive(l_shipmode, 'key_2') AS l_shipmode
FROM lineitem;

statement ok
CREATE TABLE encnaive.lineitem AS
SELECT
Expand Down
44 changes: 44 additions & 0 deletions test/sql/tpch/sf1/load_lship.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# name: test/sql/tpch/load_sf1.test
# description: Test VCRYPT encryption with OpenSSL for Loading TPC-H sf1
# this tests only encrypts one column (l_shipinstruct) from the lineitem table
# group: [vcrypt]

# Ensure any currently stored secrets don't interfere with the test
statement ok
set allow_persistent_secrets=false;

require vcrypt

require tpch

# load the DB from disk
statement ok
ATTACH 'lshipinstruct_tpch_sf1.db' AS enc_ship;

statement ok
CALL dbgen(sf=1);

statement ok
CREATE SECRET key_2 (
TYPE VCRYPT,
TOKEN 'ABCDEFGHIJKLMNOP',
LENGTH 16
);

statement ok
CREATE TABLE enc_ship.lineitem AS
SELECT
encrypt(l_shipinstruct, 'key_2') AS l_shipinstruct,
FROM lineitem;

statement ok
CHECKPOINT;

query I
SELECT decrypt(l_shipinstruct, 'key_2') FROM enc_ship.lineitem LIMIT 5;
----
DELIVER IN PERSON
TAKE BACK RETURN
TAKE BACK RETURN
NONE
NONE
38 changes: 38 additions & 0 deletions test/sql/tpch/sf1/lshipinstruct.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# name: test/sql/tpch/lshipinstruct.test
# description: Test VCRYPT encryption with OpenSSL for Loading TPC-H sf 0.01
# this tests only encrypts one column (l_shipinstruct) from the lineitem table
# group: [vcrypt]

# Ensure any currently stored secrets don't interfere with the test
statement ok
set allow_persistent_secrets=false;

require vcrypt

require tpch

# load the DB from disk
statement ok
ATTACH 'lshipinstruct_tpch_sf1.db' AS enc_ship;

statement ok
CREATE SECRET key_2 (
TYPE VCRYPT,
TOKEN 'ABCDEFGHIJKLMNOP',
LENGTH 16
);

statement ok
CREATE VIEW lineitem AS
SELECT
decrypt(l_shipinstruct, 'key_2') AS l_shipinstruct
FROM enc_ship.lineitem;

query I
SELECT l_shipinstruct FROM lineitem LIMIT 5;
----
DELIVER IN PERSON
TAKE BACK RETURN
TAKE BACK RETURN
NONE
NONE
33 changes: 29 additions & 4 deletions test/sql/vectorized/vectorized_decrypt.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,43 @@ CREATE SECRET key_1 (
LENGTH 16
);

#CREATE TABLE test_1 AS SELECT 1 AS value FROM range(1000);
statement ok
CREATE TABLE test_1 AS SELECT range AS value FROM range(1000);

statement ok
ALTER TABLE test_1 ADD COLUMN encrypted_values E_BIGINT;
ALTER TABLE test_1 ADD COLUMN value_int INT32;

statement ok
ALTER TABLE test_1 ADD COLUMN decrypted_values BIGINT;
UPDATE test_1 SET value_int = value;

statement ok
ALTER TABLE test_1 DROP COLUMN value;

statement ok
ALTER TABLE test_1 RENAME COLUMN value_int TO value;

statement ok
ALTER TABLE test_1 ADD COLUMN encrypted_values E_INTEGER;

statement ok
ALTER TABLE test_1 ADD COLUMN decrypted_values INTEGER;

statement ok
UPDATE test_1 SET encrypted_values = encrypt(value, 'key_1');

statement ok
UPDATE test_1 SET decrypted_values = decrypt(encrypted_values, 'key_1');
UPDATE test_1 SET decrypted_values = decrypt(encrypted_values, 'key_1');

query I
select value, decrypted_values from test_1 limit 10;
----
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
5 changes: 3 additions & 2 deletions test/sql/vectorized/vectorized_encrypt.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ CREATE SECRET key_1 (
LENGTH 16
);

#CREATE TABLE test_1 AS SELECT 1 AS value FROM range(1000);
statement ok
CREATE TABLE test_1 AS SELECT row_number() OVER () AS value FROM range(1000);

Expand All @@ -26,4 +25,6 @@ ALTER TABLE test_1 ADD COLUMN encrypted_values E_INTEGER;
statement ok
UPDATE test_1 SET encrypted_values = encrypt(value, 'key_1');


query I
Select * from test_1 limit 10;
----
Loading