Encryption: Add support for data keys re-encryption (#43548) (#44814)

* Encryption: Add support for data keys re-encryption

* Add tests for data keys re-encryption

* Update code after refactorings

Co-authored-by: Leonard Gram <leo@xlson.com>
(cherry picked from commit b2655750e8)

Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2022-02-03 09:58:12 +01:00
committed by GitHub
co-authored by Joan López de la Franca Beltran
parent 71a0ae7931
commit a7ad5ee55f
8 changed files with 124 additions and 0 deletions
+3
View File
@@ -24,6 +24,8 @@ type Service interface {
DecryptJsonData(ctx context.Context, sjd map[string][]byte) (map[string]string, error)
GetDecryptedValue(ctx context.Context, sjd map[string][]byte, key, fallback string) string
ReEncryptDataKeys(ctx context.Context) error
}
// Store defines methods to interact with secrets storage
@@ -33,6 +35,7 @@ type Store interface {
CreateDataKey(ctx context.Context, dataKey DataKey) error
CreateDataKeyWithDBSession(ctx context.Context, dataKey DataKey, sess *xorm.Session) error
DeleteDataKey(ctx context.Context, name string) error
ReEncryptDataKeys(ctx context.Context, providers map[ProviderID]Provider, currProvider ProviderID) error
}
// Provider is a key encryption key provider for envelope encryption