public void OFB() { AesKrypto aes = new AesKrypto(System.Security.Cryptography.CipherMode.OFB); var x = aes.Encrypt(_test, new KeyIvModel { Key = _Key, IV = _Iv }); var result = aes.Decrypt(x, new KeyIvModel { Key = _Key, IV = _Iv }); Assert.AreEqual(result, _test); }
public static void L1() { KeyStore test = new KeyStore(); test.LoadKeys("siemanko"); test.GetKey(0); AesKrypto aesKrypto = new AesKrypto(); aesKrypto.Encrypt("nowy.txt", "nowy.kz", test.GetKey(0)); aesKrypto.Decrypt("nowy.kz", "nowy1.txt", test.GetKey(0)); }
public bool LoadKeys(string password) { if (_password != password) { return(false); } string file; using (StreamReader sr = new StreamReader(_keyStore)) file = sr.ReadToEnd(); AesKrypto aes = new AesKrypto(); file = aes.Decrypt(file, new KeyIvModel { Key = _Key, IV = _Iv }); var jsonserialize = new JavaScriptSerializer(); _keys = jsonserialize.Deserialize <List <KeyIvModel> >(file); return(true); }