public void Init() { _encryptionHelper = new AesEncryptionHelper(); //for test purposes, we're generating a new key each time AesEncryptionHelper.CipherKey = AesEncryptionHelper.GenerateCipherKey(); }
public void Fail_To_Decrypt() { var plainText = "https://www.nsa.gov/"; AesEncryptionHelper.CipherKey = null; var cipherText = _encryptionHelper.EncryptAsBase64(plainText); Assert.AreNotEqual(plainText, cipherText); AesEncryptionHelper.CipherKey = AesEncryptionHelper.GenerateCipherKey();//this will yield the wrong key that was used to encrypt Assert.Throws <CryptographicException>(() => { var decryptedText = _encryptionHelper.DecryptAsBase64(cipherText); }); }
public void Generate_Key() { var key = AesEncryptionHelper.GenerateCipherKey(); }