]> git.ipfire.org Git - thirdparty/libvirt.git/commit
secret: Add functionality to load and save secrets in encrypted format
authorArun Menon <armenon@redhat.com>
Tue, 10 Feb 2026 17:56:42 +0000 (23:26 +0530)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 12 Feb 2026 16:07:58 +0000 (17:07 +0100)
commiteb0b65e07a8513cc295e9ca4f79803db6b16e113
treebfdcc71fe58a94ecb68782d8b7e4fbc954e81c76
parentbd6c201f9a17ab96baac076a12c841ee2ee99768
secret: Add functionality to load and save secrets in encrypted format

Now that we have the functionality to provide the secrets driver
with an encryption key through a configuration file or using system
credentials, and the newly introduced array to iterate over the
encryption schemes, we can use the key to save and load secrets.

Encrypt all secrets that are going to be saved on the disk if the
'secrets_encryption_key' path is set in the secret.conf file OR
if a valid systemd generated credential exists.

While loading secrets, identify the decryption method by matching the file
extension of the stored secret against the known array values.
If no matching scheme is found, the secret is skipped. If the encryption
key is changed across restarts, then also the secret driver will fail to load
the secrets from the disk that were encrypted with the former key.

Signed-off-by: Arun Menon <armenon@redhat.com>
Co-authored-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/virsecretobj.c
src/conf/virsecretobj.h
src/secret/secret_driver.c