mirror of https://github.com/postgres/postgres
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
\set tde_am tde_heap_basic
|
|
\i sql/vault_v2_test.inc
|
|
CREATE EXTENSION pg_tde;
|
|
\getenv root_token ROOT_TOKEN
|
|
SELECT pg_tde_add_key_provider_vault_v2('vault-incorrect',:'root_token','http://127.0.0.1:8200','DUMMY-TOKEN',NULL);
|
|
pg_tde_add_key_provider_vault_v2
|
|
----------------------------------
|
|
1
|
|
(1 row)
|
|
|
|
-- FAILS
|
|
SELECT pg_tde_set_principal_key('vault-v2-principal-key','vault-incorrect');
|
|
psql:sql/vault_v2_test.inc:7: ERROR: Failed to store key on keyring. Please check the keyring configuration.
|
|
CREATE TABLE test_enc(
|
|
id SERIAL,
|
|
k INTEGER DEFAULT '0' NOT NULL,
|
|
PRIMARY KEY (id)
|
|
) USING :tde_am;
|
|
psql:sql/vault_v2_test.inc:13: ERROR: failed to retrieve principal key. Create one using pg_tde_set_principal_key before using encrypted tables.
|
|
SELECT pg_tde_add_key_provider_vault_v2('vault-v2',:'root_token','http://127.0.0.1:8200','secret',NULL);
|
|
pg_tde_add_key_provider_vault_v2
|
|
----------------------------------
|
|
2
|
|
(1 row)
|
|
|
|
SELECT pg_tde_set_principal_key('vault-v2-principal-key','vault-v2');
|
|
pg_tde_set_principal_key
|
|
--------------------------
|
|
t
|
|
(1 row)
|
|
|
|
CREATE TABLE test_enc(
|
|
id SERIAL,
|
|
k INTEGER DEFAULT '0' NOT NULL,
|
|
PRIMARY KEY (id)
|
|
) USING :tde_am;
|
|
INSERT INTO test_enc (k) VALUES (1);
|
|
INSERT INTO test_enc (k) VALUES (2);
|
|
INSERT INTO test_enc (k) VALUES (3);
|
|
SELECT * from test_enc;
|
|
id | k
|
|
----+---
|
|
1 | 1
|
|
2 | 2
|
|
3 | 3
|
|
(3 rows)
|
|
|
|
DROP TABLE test_enc;
|
|
DROP EXTENSION pg_tde;
|
|
|