Hi Robert:
I think I have a little confuse about the relationship between the key provider and the principal key.
According to your description " you’ll have two choices; either copy the new key under a new name and use it or add another provider altogether.", I will try to describe my opinion, if I am wrong, please correct me. Thx!
If this is my statement below(two keys):
[root@vbox keyring]# ls
tde_key tde_key_new
[root@vbox keyring]# pwd
/usr/local/pgsql/keyring
postgres=# SELECT pg_tde_principal_key_info();
(my-master-key,file-provider,1,"2025-04-14 14:25:18.656093+08")
postgres=# SELECT pg_tde_list_all_key_providers();
(1,file-provider,file,"{""type"" : ""file"", ""path"" : ""/usr/local/pgsql/keyring/tde_key""}")
==============
The first choice:
Just like what you said, I can use this command to rotate my key.
postgres=# select pg_tde_change_key_provider_file('file-provider','/usr/local/pgsql/keyring/tde_key_new');
1
postgres=# SELECT pg_tde_principal_key_info();
(my-master-key,file-provider,1,"2025-04-14 14:25:18.656093+08")
postgres=# SELECT pg_tde_list_all_key_providers();
(1,file-provider,file,"{""type"" : ""file"", ""path"" : ""/usr/local/pgsql/keyring/tde_key_new""}")
==============
The Second choice:
I need to create a new key provider to link with the tde_key_new.
postgres=# SELECT pg_tde_add_key_provider_file('file-provider-new', '/usr/local/pgsql/keyring/tde_key_new');
2
postgres=# SELECT pg_tde_set_principal_key('my-master-key','file-provider-new','true');
t
postgres=# SELECT pg_tde_principal_key_info();
(my-master-key,file-provider-new,2,"2025-05-02 15:54:09.893777+08")
postgres=# SELECT pg_tde_list_all_key_providers();
(1,file-provider,file,"{""type"" : ""file"", ""path"" : ""/usr/local/pgsql/keyring/tde_key""}")
(2,file-provider-new,file,"{""type"" : ""file"", ""path"" : ""/usr/local/pgsql/keyring/tde_key_new""}")
When I need rotate the “key”, it seems should be the key under the /keyring path, not the my-master-key, right?
What is the situation that I need to change the principal key?
I think this info is very important right?

If I want to use it in my environment, it seems I need to copy the tde_key to another server to store it? Would you give me a example?
Thx!