public void ItShouldEncryptAndDecryptSymmetrically() { var expected = "123456"; var encryptedValue = _unit.EncryptStringAES(expected); var actual = _unit.DecryptStringAES(encryptedValue); Assert.AreEqual(expected, actual); }
public string CreatePayload(string id, IPrincipal user) { var model = new PermissionCookieModel { Id = id, EndDate = DateTime.UtcNow.AddMinutes(_challengeSettings.ChallengeTimeoutMinutes) }; var json = JsonConvert.SerializeObject(model, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(_crypto.EncryptStringAES(json)); }
public void ItShouldThrowAnExceptionIfTheTextIsEmpty() { Assert.Throws <ArgumentNullException>(() => _unit.EncryptStringAES(string.Empty)); }