Support rotation of master key.
The EncryptionService now loads a set of keys and uses the active one to encrypt and selects key based on keyid during decryption. Introduced EncryptedValue to hold keyId and encrypted data. (There are no intermeddiate keys yet)
This commit is contained in:
parent
4201d0240d
commit
644b005f2a
19 changed files with 259 additions and 72 deletions
|
|
@ -2,6 +2,6 @@ namespace IdentityShroud.Core.Contracts;
|
|||
|
||||
public interface IEncryptionService
|
||||
{
|
||||
byte[] Encrypt(ReadOnlyMemory<byte> plain);
|
||||
byte[] Decrypt(ReadOnlyMemory<byte> cipher);
|
||||
EncryptedValue Encrypt(ReadOnlyMemory<byte> plain);
|
||||
byte[] Decrypt(EncryptedValue input);
|
||||
}
|
||||
|
|
@ -3,4 +3,10 @@ namespace IdentityShroud.Core.Contracts;
|
|||
public interface ISecretProvider
|
||||
{
|
||||
string GetSecret(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Should return one active key, might return inactive keys.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
EncryptionKey[] GetKeys(string name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue