Files
c90e2e8e5e SecretsManager: Add (en/de)cryption packages (#104923)
Merging the code as-is from the feature branch: secret-service/feature-branch

Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>
Co-authored-by: Dana Axinte <53751979+dana-axinte@users.noreply.github.com>
Co-authored-by: Leandro Deveikis <leandro.deveikis@gmail.com>
Co-authored-by: Mariell Hoversholm <mariell.hoversholm@grafana.com>
Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
2025-05-05 15:26:52 +02:00

15 lines
523 B
Go

package provider
import (
"crypto/pbkdf2"
"crypto/sha256"
)
// aes256CipherKey is used to calculate a key for AES-256 blocks.
// It returns a key of 32 bytes, which causes aes.NewCipher to choose AES-256.
// The implementation is equal to that of the legacy secrets system.
// If this changes, we either need to rotate all encrypted secrets, or keep a fallback implementation (being this).
func aes256CipherKey(password string, salt []byte) ([]byte, error) {
return pbkdf2.Key(sha256.New, password, salt, 10000, 32)
}