IdentityShroud/IdentityShroud.Core.Tests/Services/EncryptionServiceTests.cs
eelke 92b34bd0b5 Happy flow for creating realms works
But needs more validating...
2026-02-08 11:57:57 +01:00

22 lines
No EOL
559 B
C#

using System.Security.Cryptography;
using IdentityShroud.Core.Services;
namespace IdentityShroud.Core.Tests.Services;
public class EncryptionServiceTests
{
[Fact]
public void RoundtripWorks()
{
// setup
string key = Convert.ToBase64String(RandomNumberGenerator.GetBytes(32));
EncryptionService sut = new(key);
byte[] input = RandomNumberGenerator.GetBytes(16);
// act
var cipher = sut.Encrypt(input);
var result = sut.Decrypt(cipher);
Assert.Equal(input, result);
}
}