Reworked encryption to use less heap allocated buffers for secrets.
Also some work on plugin system.
This commit is contained in:
parent
8782ef39c6
commit
054754f553
42 changed files with 1452 additions and 242 deletions
|
|
@ -18,8 +18,6 @@ public class DekEncryptionService : IDekEncryptionService
|
|||
public DekEncryptionService(ISecretProvider secretProvider)
|
||||
{
|
||||
_encryptionKeys = secretProvider.GetKeys("master");
|
||||
// if (_encryptionKey.Length != 32) // 256‑bit key
|
||||
// throw new Exception("Key must be 256 bits (32 bytes) for AES‑256‑GCM.");
|
||||
}
|
||||
|
||||
public EncryptedDek Encrypt(ReadOnlySpan<byte> plaintext)
|
||||
|
|
@ -29,10 +27,14 @@ public class DekEncryptionService : IDekEncryptionService
|
|||
return new (encryptionKey.Id, cipher);
|
||||
}
|
||||
|
||||
public byte[] Decrypt(EncryptedDek input)
|
||||
public void Decrypt(EncryptedDek input, Span<byte> output)
|
||||
{
|
||||
var encryptionKey = GetKey(input.KekId);
|
||||
Encryption.Decrypt(input.Value, encryptionKey.Key, output);
|
||||
}
|
||||
|
||||
return Encryption.Decrypt(input.Value, encryptionKey.Key);
|
||||
public int GetDecryptedSize(EncryptedDek input)
|
||||
{
|
||||
return Encryption.GetDecryptedLength(input.Value);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue