diff --git a/test/sql/tpch/naive/sf1/load_sf1.test b/test/sql/tpch/naive/sf1/load_sf1.test index e9175e6..6d23b55 100644 --- a/test/sql/tpch/naive/sf1/load_sf1.test +++ b/test/sql/tpch/naive/sf1/load_sf1.test @@ -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); @@ -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 diff --git a/test/sql/tpch/sf1/load_lship.test b/test/sql/tpch/sf1/load_lship.test new file mode 100644 index 0000000..bb6aa21 --- /dev/null +++ b/test/sql/tpch/sf1/load_lship.test @@ -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 \ No newline at end of file diff --git a/test/sql/tpch/sf1/lshipinstruct.test b/test/sql/tpch/sf1/lshipinstruct.test new file mode 100644 index 0000000..eeeb81c --- /dev/null +++ b/test/sql/tpch/sf1/lshipinstruct.test @@ -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 \ No newline at end of file diff --git a/test/sql/vectorized/vectorized_decrypt.test b/test/sql/vectorized/vectorized_decrypt.test index 62c8b70..24cbe11 100644 --- a/test/sql/vectorized/vectorized_decrypt.test +++ b/test/sql/vectorized/vectorized_decrypt.test @@ -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'); \ No newline at end of file +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 \ No newline at end of file diff --git a/test/sql/vectorized/vectorized_encrypt.test b/test/sql/vectorized/vectorized_encrypt.test index b503c50..a9eed52 100644 --- a/test/sql/vectorized/vectorized_encrypt.test +++ b/test/sql/vectorized/vectorized_encrypt.test @@ -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); @@ -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; +----