22 lines
No EOL
605 B
C#
22 lines
No EOL
605 B
C#
using System.Text;
|
|
using IdentityShroud.Core.Model;
|
|
using IdentityShroud.Core.Security;
|
|
|
|
namespace IdentityShroud.Core.Contracts;
|
|
|
|
public interface IDataEncryptionService
|
|
{
|
|
EncryptedValue Encrypt(RealmDek dek, ReadOnlySpan<byte> plain);
|
|
byte[] Decrypt(IReadOnlyList<RealmDek> deks, EncryptedValue input);
|
|
}
|
|
|
|
public static class DataEncryptionServiceExtensions
|
|
{
|
|
public static string DecryptUtf8ToString(
|
|
this IDataEncryptionService des,
|
|
IReadOnlyList<RealmDek> deks,
|
|
EncryptedValue input)
|
|
{
|
|
return Encoding.UTF8.GetString(des.Decrypt(deks, input));
|
|
}
|
|
} |