public void TestUnicodeCharsEncryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); string message = "漢語"; message = Common.SerializeUsingJSONFx(message); Console.WriteLine(message); string encrypted = pubnubCrypto.Encrypt(message); Console.WriteLine(encrypted); Assert.AreEqual("+BY5/miAA8aeuhVl4d13Kg==", encrypted); }
public void TestMyObjectEncryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //create an object of the custom class CustomClass cc = new CustomClass(); //serialize it string result = Common.SerializeUsingJSONFx(cc); //encrypt it string encrypted = pubnubCrypto.Encrypt(result); Assert.AreEqual("Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE=", encrypted); }
public void TestObjectEncryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //create an object Object obj = new Object(); //serialize string strObj = Common.SerializeUsingJSONFx(obj); //encrypt string encrypted = pubnubCrypto.Encrypt(strObj); Assert.AreEqual("IDjZE9BHSjcX67RddfCYYg==", encrypted); }
public void TestArrayEncryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //create an empty array object object[] objArr = { }; string strArr = Common.SerializeUsingJSONFx(objArr); //Encrypt string encrypted = pubnubCrypto.Encrypt(strArr); Assert.AreEqual("Ns4TB41JjT2NCXaGLWSPAQ==", encrypted); }
public void TestGermanCharsEncryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); string message = "ÜÖ"; message = Common.SerializeUsingJSONFx(message); Console.WriteLine(message); string encrypted = pubnubCrypto.Encrypt(message); Console.WriteLine(encrypted); Assert.AreEqual("stpgsG1DZZxb44J7mFNSzg==", encrypted); }
public void TestPubNubEncryption1JSONFX() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //non serialized string string message = "Pubnub Messaging API 1"; //serialize message = Common.SerializeUsingJSONFx(message); //encrypt string encrypted = pubnubCrypto.Encrypt(message); Assert.AreEqual("f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=", encrypted); }
public void TestPubNubEncryption2JSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //Deserialized string message = "Pubnub Messaging API 2"; //serialize the message message = Common.SerializeUsingJSONFx(message); //encrypt string encrypted = pubnubCrypto.Encrypt(message); Assert.AreEqual("f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=", encrypted); }
public void TestMyObjectDecryptionJSONFx() { 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.SerializeUsingJSONFx(cc); Assert.AreEqual(decrypted, result); }
public void TestObjectDecryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //Deserialized string message = "IDjZE9BHSjcX67RddfCYYg=="; //Decrypt string decrypted = pubnubCrypto.Decrypt(message); //create an object Object obj = new Object(); //Serialize the object string result = Common.SerializeUsingJSONFx(obj); Assert.AreEqual(decrypted, result); }
public void TestYayEncryptionJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //deserialized string string message = "yay!"; //serialize the string message = Common.SerializeUsingJSONFx(message); Console.WriteLine(message); //Encrypt string encrypted = pubnubCrypto.Encrypt(message); Assert.AreEqual("Wi24KS4pcTzvyuGOHubiXg==", encrypted); }
public void TestArrayDecryptionUsingJSONFx() { PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma"); //Input the deserialized string string message = "Ns4TB41JjT2NCXaGLWSPAQ=="; //decrypt string decrypted = pubnubCrypto.Decrypt(message); //create a serialized object object[] objArr = { }; string result = Common.SerializeUsingJSONFx(objArr); //compare the serialized object and the return of the Decrypt method Assert.AreEqual(result, decrypted); }