-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A function to get the current master key info. #150
Conversation
Commit adds tde_master_key_info() function that returns the information about the master key for the database. select * from tde_master_key_info(); master_key_name | key_provider_name | key_provider_id | master_key_internal_name | master_key_version | key_createion_time -----------------+-------------------+-----------------+--------------------------+--------------------+------------------------------- test-master-key | file-two | 1 | test-master-key_1 | 1 | 2024-03-25 18:07:13.131834+05 (1 row)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor formatting related comments, but I think we also might have an issue with an unconfigured pg_tde, please add a test about that too
src/catalog/tde_master_key.c
Outdated
@@ -31,7 +32,7 @@ | |||
|
|||
#define DEFAULT_MASTER_KEY_VERSION 1 | |||
|
|||
typedef struct TdeMasterKeySharedState | |||
typedef struct TdeMasterKeySharedState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary formatting change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was un-intentional. Thanks for pointing out. Fixed
src/catalog/tde_master_key.c
Outdated
GenericKeyring *keyring; | ||
|
||
/* Build a tuple descriptor for our result type */ | ||
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also inconsistent indentation in this function
@@ -21,6 +21,9 @@ SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE | |||
SELECT pgtde_is_encrypted('test_enc'); | |||
SELECT pgtde_is_encrypted('test_norm'); | |||
|
|||
SELECT key_provider_id, key_provider_name, master_key_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also have a test with the extension enabled, but without anything configured? (no provider / master key added)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), | ||
errmsg("function returning record called in context that cannot accept type record"))); | ||
|
||
master_key = GetMasterKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
master_key
can be NULL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetMasterKey() throws an ERROR when it can't return the master key. I have still added a check here.
Commit adds tde_master_key_info() function that returns the information about the master key for the database.
select * from tde_master_key_info();
master_key_name | key_provider_name | key_provider_id | master_key_internal_name | master_key_version | key_createion_time
-----------------+-------------------+-----------------+--------------------------+--------------------+-------------------------------
test-master-key | file-two | 1 | test-master-key_1 | 1 | 2024-03-25 18:07:13.131834+05
(1 row)