public void TestYayDecryptionBasic() { PubnubCrypto pc = new PubnubCrypto("enigma"); string strMessage = "q/xJqqN6qbiZMXYmiQC1Fw=="; //decrypt string dec = pc.decrypt(strMessage); //deserialize again Assert.AreEqual("yay!", dec); }
public void TestNullEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //serialized string string strMessage = null; //encrypt string enc = pc.encrypt(strMessage); }
public void TestNullDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string strMessage = null; //decrypt string dec = pc.decrypt(strMessage); Assert.AreEqual("", dec); }
public void TestObjectDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string message = "IDjZE9BHSjcX67RddfCYYg=="; //Decrypt string decryptedMessage = pc.Decrypt(message); //create an object Object obj = new Object(); //Serialize the object string result = JsonConvert.SerializeObject(obj); int same = string.Compare(result, decryptedMessage, StringComparison.InvariantCulture); Assert.IsTrue(same == 0); }
public void TestMyObjectDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string message = "Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE="; //Decrypt string decryptedMessage = pc.Decrypt(message); //create an object of the custom class CustomClass cc = new CustomClass(); //Serialize it string result = JsonConvert.SerializeObject(cc); int same = string.Compare(result, decryptedMessage, StringComparison.InvariantCulture); Assert.IsTrue(same == 0); }
//will fail with minijson //[Test] public void TestMyObjectDecryptionMiniJson() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //Deserialized string message = "Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE="; //Decrypt string decrypted = pubnubCrypto.Decrypt(message); //create an object of the custom class CustomClass cc = new CustomClass(); //Serialize it string result = Common.SerializeMiniJson(cc); UnityEngine.Debug.Log("decrypted:" + decrypted); UnityEngine.Debug.Log("result:" + result); Assert.True((decrypted).Equals(result)); }
public void TestArrayDecryptionUsingMiniJson() { pn = EditorCommon.InitPN(pnConfig); PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog); //Input the deserialized string string message = "Ns4TB41JjT2NCXaGLWSPAQ=="; //decrypt string decrypted = pubnubCrypto.Decrypt(message); //create a serialized object object[] objArr = { }; string result = Common.SerializeMiniJson(objArr); //compare the serialized object and the return of the Decrypt method Assert.True((result).Equals(decrypted)); }
public void TestYayDecryption() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //Non deserialized string string message = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize message = Common.Deserialize <string> (message); //decrypt string decrypted = pubnubCrypto.Decrypt(message); //deserialize again message = Common.Deserialize <string> (decrypted); Assert.True(("yay!").Equals(message)); }
public void TestYayDecryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //Non deserialized string string message = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize message = Common.DeserializeUsingJSONFx <string>(message); //decrypt string decrypted = pubnubCrypto.Decrypt(message); //deserialize again message = Common.DeserializeUsingJSONFx <string>(decrypted); Assert.AreEqual("yay!", message); }
public void TestArrayDecryption() { Debug.Log("Running TestArrayDecryption()"); PubnubCrypto pc = new PubnubCrypto("enigma"); //Input the deserialized string string message = "Ns4TB41JjT2NCXaGLWSPAQ=="; //decrypt string decryptedMessage = pc.Decrypt(message); //create a serialized object object[] emptyArrayObject = { }; string result = JsonConvert.SerializeObject(emptyArrayObject); //compare the serialized object and the return of the Decrypt method UUnitAssert.Equals(result, decryptedMessage); }
public void TestObjectDecryption() { Debug.Log("Running TestObjectDecryption()"); PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string message = "IDjZE9BHSjcX67RddfCYYg=="; //Decrypt string decryptedMessage = pc.Decrypt(message); //create an object System.Object obj = new System.Object(); //Serialize the object string result = JsonConvert.SerializeObject(obj); UUnitAssert.Equals(result, decryptedMessage); }
public void TestYayEncryptionBasic() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string message = "yay!"; //Encrypt string encryptedMessage = pc.Encrypt(message); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("q/xJqqN6qbiZMXYmiQC1Fw==", encryptedMessage); TestComplete(); }); }); }
public void TestStuffcanDecryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string message = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF"; //Decrypt string decryptedMessage = pc.Decrypt(message); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("{\"this stuff\":{\"can get\":\"complicated!\"}}", decryptedMessage); TestComplete(); }); }); }
public void TestHashEncryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //serialized string string message = "{\"foo\":{\"bar\":\"foobar\"}}"; //Encrypt string encryptedMessage = pc.Encrypt(message); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=", encryptedMessage); TestComplete(); }); }); }
public void TestArrayDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Input the deserialized string string message = "Ns4TB41JjT2NCXaGLWSPAQ=="; //decrypt string decryptedMessage = pc.Decrypt(message); //create a serialized object object[] emptyArrayObject = { }; string result = JsonConvert.SerializeObject(emptyArrayObject); int same = String.Compare(result, decryptedMessage, StringComparison.InvariantCulture); //compare the serialized object and the return of the Decrypt method Assert.IsTrue(same == 0); }
public void TestYayDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\""; //Non deserialized string string message = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize message = JsonConvert.DeserializeObject <string>(message); //decrypt string decryptedMessage = pc.Decrypt(message); //deserialize again message = JsonConvert.DeserializeObject <string>(decryptedMessage); Assert.True("yay!" == message); }
public void TestArrayDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Input the deserialized string string strMessage = "Ns4TB41JjT2NCXaGLWSPAQ=="; //decrypt string dec = pc.decrypt(strMessage); //create a serialized object object [] objArr = {}; JavaScriptSerializer js = new JavaScriptSerializer(); string res = js.Serialize(objArr); //compare the serialized object and the return of the Decrypt method Assert.AreEqual(res, dec); }
//[ExpectedException (typeof(ArgumentNullException))] public void TestNullDecryption() { pn = EditorCommon.InitPN(pnConfig); PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog); //deserialized string string message = null; //decrypt var ex = Assert.Throws <ArgumentNullException>(() => pubnubCrypto.Decrypt(message)); /* #if UNITY_2019_1_OR_NEWER */ Assert.That(ex.Message.Contains("Value cannot be null."), ex.Message, null); /* #else * Assert.That(ex.Message.Contains("Argument cannot be null."),ex.Message, null); #endif*/ }
public void TestYayDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\""; //Non deserialized string string strMessage = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize //JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = JsonConvert.DeserializeObject <string>(strMessage); //decrypt string dec = pc.decrypt(strMessage); //deserialize again strMessage = JsonConvert.DeserializeObject <string>(dec); Assert.True(("yay!").Equals(strMessage)); }
public void TestGermanCharsDecryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); string message = "stpgsG1DZZxb44J7mFNSzg=="; //Decrypt string decryptedMessage = pc.Decrypt(message); //deserialize message = (decryptedMessage != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject <string>(decryptedMessage) : ""; Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("ÜÖ", message); TestComplete(); }); }); }
public void TestYayDecryption() { Debug.Log("Running TestYayDecryption()"); PubnubCrypto pc = new PubnubCrypto("enigma"); //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\""; //Non deserialized string string message = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize message = JsonConvert.DeserializeObject <string>(message); //decrypt string decryptedMessage = pc.Decrypt(message); //deserialize again message = JsonConvert.DeserializeObject <string>(decryptedMessage); UUnitAssert.Equals("yay!", message); }
public void TestYayDecryptionMiniJson() { pn = EditorCommon.InitPN(pnConfig); PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog); //Non deserialized string string message = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize message = Common.DeserializeMiniJson <string> (message); //decrypt string decrypted = pubnubCrypto.Decrypt(message); //deserialize again message = Common.DeserializeMiniJson <string> (decrypted); Assert.True(("yay!").Equals(message)); }
public void TestYayDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\""; //Non deserialized string string strMessage = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Deserialize <string>(strMessage); //decrypt string dec = pc.decrypt(strMessage); //deserialize again strMessage = js.Deserialize <string>(dec); Assert.AreEqual("yay!", strMessage); }
public void TestGermanCharsEncryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); string message = "ÜÖ"; message = JsonConvert.SerializeObject(message); Console.WriteLine(message); string encryptedMessage = pc.Encrypt(message); Console.WriteLine(encryptedMessage); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("stpgsG1DZZxb44J7mFNSzg==", encryptedMessage); TestComplete(); }); }); }
public void TestPubNubDecryption1() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string message = "f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0="; //Decrypt string decryptedMessage = pc.Decrypt(message); //deserialize message = (decryptedMessage != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject <string>(decryptedMessage) : ""; Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("Pubnub Messaging API 1", message); TestComplete(); }); }); }
public void TestUnicodeCharsDecryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); string message = "+BY5/miAA8aeuhVl4d13Kg=="; //JavaScriptSerializer js = new JavaScriptSerializer(); //Decrypt string decryptedMessage = pc.Decrypt(message); //deserialize message = (decryptedMessage != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject <string>(decryptedMessage) : ""; Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("漢語", message); TestComplete(); }); }); }
public void TestPubNubDecryption2() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string string message = "f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54="; //Decrypt string decryptedMessage = pc.Decrypt(message); //Deserialize message = JsonConvert.DeserializeObject <string>(decryptedMessage); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("Pubnub Messaging API 2", message); TestComplete(); }); }); }
public void TestUnicodeCharsEncryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); string message = "漢語"; message = JsonConvert.SerializeObject(message); Console.WriteLine(message); string encryptedMessage = pc.Encrypt(message); Console.WriteLine(encryptedMessage); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("+BY5/miAA8aeuhVl4d13Kg==", encryptedMessage); TestComplete(); }); }); }
public void TestObjectEncryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //create an object Object obj = new Object(); //serialize string serializedObject = JsonConvert.SerializeObject(obj); //Encrypt string encryptedMessage = pc.Encrypt(serializedObject); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("IDjZE9BHSjcX67RddfCYYg==", encryptedMessage); TestComplete(); }); }); }
public void TestPubNubEncryption1() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //non serialized string string message = "Pubnub Messaging API 1"; //serialize message = JsonConvert.SerializeObject(message); //Encrypt string encryptedMessage = pc.Encrypt(message); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=", encryptedMessage); TestComplete(); }); }); }
public void TestArrayEncryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //create an empty array object object[] emptyArray = { }; //serialize string serializedArray = JsonConvert.SerializeObject(emptyArray); //Encrypt string encryptedMessage = pc.Encrypt(serializedArray); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("Ns4TB41JjT2NCXaGLWSPAQ==", encryptedMessage); TestComplete(); }); }); }
public void TestYayEncryptionBasicWithDynamicIV() { IPubnubUnitTest pubnubUnitTest = new PubnubUnitTest(); pubnubUnitTest.IV = new byte[16] { 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54 }; PNConfiguration config = new PNConfiguration { UseRandomInitializationVector = true }; PubnubCrypto pc = new PubnubCrypto("enigma", config, null, pubnubUnitTest); ////deserialized string string message = "yay!"; ////Encrypt string encryptedMessage = pc.Encrypt(message); Assert.AreEqual("MTIzNDU2Nzg5MDEyMzQ1NjdnONoCgo0wbuMGGMmfMX0=", encryptedMessage); }
public void TestMyObjectEncryption() { ThreadPool.QueueUserWorkItem((s) => { PubnubCrypto pc = new PubnubCrypto("enigma"); //create an object of the custom class CustomClass cc = new CustomClass(); //serialize it string result = JsonConvert.SerializeObject(cc); //Encrypt it string encryptedMessage = pc.Encrypt(result); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.AreEqual("Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE=", encryptedMessage); TestComplete(); }); }); }
public void TestObjectEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //create an object Object obj = new Object(); //serialize JavaScriptSerializer js = new JavaScriptSerializer(); string strObj = js.Serialize(obj); //encrypt string enc = pc.encrypt(strObj); Assert.AreEqual("IDjZE9BHSjcX67RddfCYYg==", enc); }
public void TestObjectDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string strMessage = "IDjZE9BHSjcX67RddfCYYg=="; //Decrypt string dec = pc.decrypt(strMessage); //create an object Object obj = new Object(); //Serialize the object JavaScriptSerializer js = new JavaScriptSerializer(); string res = js.Serialize(obj); Assert.AreEqual(res, dec); }
public void TestGermanCharsEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); string strMessage = "ÜÖ"; JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Serialize(strMessage); Console.WriteLine(strMessage); string enc = pc.encrypt(strMessage); Console.WriteLine(enc); Assert.AreEqual("stpgsG1DZZxb44J7mFNSzg==", enc); }
public void TestArrayEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //create an empty array object object[] objArr = { }; //serialize JavaScriptSerializer js = new JavaScriptSerializer(); string strArr = js.Serialize(objArr); //Encrypt string enc = pc.encrypt(strArr); Assert.AreEqual("Ns4TB41JjT2NCXaGLWSPAQ==", enc); }
public void TestGermanCharsDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); string strMessage = "stpgsG1DZZxb44J7mFNSzg=="; JavaScriptSerializer js = new JavaScriptSerializer(); //decrypt string dec = pc.decrypt(strMessage); //deserialize strMessage = js.Deserialize<string>(dec); Assert.AreEqual("ÜÖ", strMessage); }
public void TestPubNubEncryption1() { PubnubCrypto pc = new PubnubCrypto("enigma"); //non serialized string string strMessage = "Pubnub Messaging API 1"; //serialize JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Serialize(strMessage); //encrypt string enc = pc.encrypt(strMessage); Assert.AreEqual("f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=", enc); }
public void TestPubNubDecryption1() { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string strMessage = "f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0="; JavaScriptSerializer js = new JavaScriptSerializer(); //decrypt string dec = pc.decrypt(strMessage); //deserialize strMessage = js.Deserialize<string>(dec); Assert.AreEqual("Pubnub Messaging API 1", strMessage); }
public void TestStuffcanDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string strMessage = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF"; //decrypt string dec = pc.decrypt(strMessage); Assert.AreEqual("{\"this stuff\":{\"can get\":\"complicated!\"}}", dec); }
public void TestHashDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string strMessage = "GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g="; //decrypt string dec = pc.decrypt(strMessage); Assert.AreEqual("{\"foo\":{\"bar\":\"foobar\"}}", dec); }
public void TestUnicodeCharsEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); string strMessage = "漢語"; JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Serialize(strMessage); Console.WriteLine(strMessage); string enc = pc.encrypt(strMessage); Console.WriteLine(enc); Assert.AreEqual("+BY5/miAA8aeuhVl4d13Kg==", enc); }
public void TestUnicodeCharsDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); string strMessage = "+BY5/miAA8aeuhVl4d13Kg=="; JavaScriptSerializer js = new JavaScriptSerializer(); //decrypt string dec = pc.decrypt(strMessage); //deserialize strMessage = js.Deserialize<string>(dec); Assert.AreEqual("漢語", strMessage); }
public void TestPubNubDecryption2() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string string strMessage = "f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54="; //Decrypt string dec = pc.decrypt(strMessage); //Deserialize JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Deserialize<string>(dec); Assert.AreEqual("Pubnub Messaging API 2", strMessage); }
public void TestYayEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string strMessage = "yay!"; //serialize the string JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Serialize(strMessage); Console.WriteLine(strMessage); //Encrypt string enc = pc.encrypt(strMessage); Assert.AreEqual("Wi24KS4pcTzvyuGOHubiXg==", enc); }
public void TestArrayDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Input the deserialized string string strMessage = "Ns4TB41JjT2NCXaGLWSPAQ=="; //decrypt string dec = pc.decrypt(strMessage); //create a serialized object object[] objArr = { }; JavaScriptSerializer js = new JavaScriptSerializer(); string res = js.Serialize(objArr); //compare the serialized object and the return of the Decrypt method Assert.AreEqual(res, dec); }
public void TestPubNubEncryption2() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string strMessage = "Pubnub Messaging API 2"; //serialize the message JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Serialize(strMessage); //encrypt string enc = pc.encrypt(strMessage); Assert.AreEqual("f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=", enc); }
public void TestMyObjectDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string strMessage = "Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE="; //Decrypt string dec = pc.decrypt(strMessage); //create an object of the custom class CustomClass cc = new CustomClass(); JavaScriptSerializer js = new JavaScriptSerializer(); //Serialize it string res = js.Serialize(cc); Assert.AreEqual(res, dec); }
public void TestMyObjectEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //create an object of the custom class CustomClass cc = new CustomClass(); //serialize it JavaScriptSerializer js = new JavaScriptSerializer(); string res = js.Serialize(cc); //encrypt it string enc = pc.encrypt(res); Assert.AreEqual("Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE=", enc); }
public void TestYayDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\""; //Non deserialized string string strMessage = "\"Wi24KS4pcTzvyuGOHubiXg==\""; //Deserialize JavaScriptSerializer js = new JavaScriptSerializer(); strMessage = js.Deserialize<string>(strMessage); //decrypt string dec = pc.decrypt(strMessage); //deserialize again strMessage = js.Deserialize<string>(dec); Assert.AreEqual("yay!", strMessage); }
public void TestYayEncryptionBasic() { PubnubCrypto pc = new PubnubCrypto("enigma"); //deserialized string string strMessage = "yay!"; //Encrypt string enc = pc.encrypt(strMessage); Assert.AreEqual("q/xJqqN6qbiZMXYmiQC1Fw==", enc); }