22 lines
698 B
C#
22 lines
698 B
C#
using Xunit;
|
|
using Landmark.OLA.Application.Common.Security;
|
|
|
|
namespace OnlineBankingAuth.Tests
|
|
{
|
|
public class CookieCrytorTest
|
|
{
|
|
[Fact]
|
|
public void EncryptAndDecrypt()
|
|
{
|
|
var sampleUnencryptedString = "This string will be encrypted and decrypted in this test";
|
|
var secret = "A secret to serve as a key in our symmetric encryption";
|
|
|
|
var encrypted = CookieCryptor.EncryptJwt(sampleUnencryptedString, secret);
|
|
Assert.NotEqual(sampleUnencryptedString, encrypted);
|
|
|
|
var decrypted = CookieCryptor.DecryptJwt(encrypted, secret);
|
|
Assert.Equal(sampleUnencryptedString, decrypted);
|
|
}
|
|
}
|
|
}
|