Miscelanious trials
This commit is contained in:
commit
f99c97f392
33 changed files with 881 additions and 0 deletions
21
IdentityShroud.Core.Tests/Security/AesGcmHelperTests.cs
Normal file
21
IdentityShroud.Core.Tests/Security/AesGcmHelperTests.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using IdentityShroud.Core.Security;
|
||||
|
||||
namespace IdentityShroud.Core.Tests.Security;
|
||||
|
||||
public class AesGcmHelperTests
|
||||
{
|
||||
[Fact]
|
||||
public void EncryptDecryptCycleWorks()
|
||||
{
|
||||
string input = "Hello, world!";
|
||||
|
||||
var encryptionKey = RandomNumberGenerator.GetBytes(32);
|
||||
|
||||
var cypher = AesGcmHelper.EncryptAesGcm(Encoding.UTF8.GetBytes(input), encryptionKey);
|
||||
var output = AesGcmHelper.DecryptAesGcm(cypher, encryptionKey);
|
||||
|
||||
Assert.Equal(input, Encoding.UTF8.GetString(output));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue