public void Dencrypt() { try { string plain = "Plain TextABCDEF"; string k1 = "0123456789ABCDEF"; string k2 = "io.github.odys-z"; byte[] iv64 = AESHelper.getRandom(); string iv = AESHelper.Encode64(iv64); string cypher = AESHelper.Encrypt(plain, k1, iv64); string[] cypherss = AESHelper.Dencrypt(cypher, k1, iv, k2); Assert.AreEqual(plain, AESHelper.Decrypt(cypherss[0], k2, AESHelper.Decode64(cypherss[1]))); Debug.WriteLine("Check this at server side:"); Debug.WriteLine(string.Format("Cypher:\n{0}", cypherss[0])); Debug.WriteLine(string.Format("Key:\n{0},\nIV:\n{1}", k2, cypherss[1])); Debug.WriteLine(string.Format("Expacting:\n{0}", plain)); plain = "Слава Україні"; cypher = AESHelper.Encrypt(plain, k1, iv64); cypherss = AESHelper.Dencrypt(cypher, k1, iv, k2); Assert.AreEqual(plain, AESHelper.Decrypt(cypherss[0], k2, AESHelper.Decode64(cypherss[1]))); } catch (Exception e) { Debug.WriteLine(e.ToString()); Assert.Fail(e.Message); } }