本文整理汇总了C#中PubNub_Messaging.PubnubCrypto.decrypt方法的典型用法代码示例。如果您正苦于以下问题:C# PubnubCrypto.decrypt方法的具体用法?C# PubnubCrypto.decrypt怎么用?C# PubnubCrypto.decrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PubNub_Messaging.PubnubCrypto
的用法示例。
在下文中一共展示了PubnubCrypto.decrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestNullDecryption
public void TestNullDecryption()
{
bool isExpectedException = false;
string dec = "";
ThreadPool.QueueUserWorkItem((s) =>
{
PubnubCrypto pc = new PubnubCrypto("enigma");
//deserialized string
string strMessage = null;
try
{
//decrypt
dec = pc.decrypt(strMessage);
}
catch (ArgumentNullException ane)
{
isExpectedException = true;
}
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
//Assert.AreEqual("", dec);
Assert.IsTrue(isExpectedException);
TestComplete();
});
});
}
示例2: TestYayDecryptionBasic
public void TestYayDecryptionBasic()
{
PubnubCrypto pc = new PubnubCrypto("enigma");
string strMessage = "q/xJqqN6qbiZMXYmiQC1Fw==";
//decrypt
string dec = pc.decrypt(strMessage);
//deserialize again
Assert.AreEqual("yay!", dec);
}
示例3: TestNullDecryption
public void TestNullDecryption()
{
PubnubCrypto pc = new PubnubCrypto("enigma");
//deserialized string
string strMessage = null;
//decrypt
string dec = pc.decrypt(strMessage);
Assert.AreEqual("", dec);
}
示例4: TestGermanCharsDecryption
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);
}
示例5: TestArrayDecryption
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);
}
示例6: TestYayDecryption
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));
}
示例7: TestPubNubDecryption1
public void TestPubNubDecryption1()
{
ThreadPool.QueueUserWorkItem((s) =>
{
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);
//strMessage = JsonConvert.DeserializeObject<string>(dec);
strMessage = (dec != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject<string>(dec) : "";
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
Assert.AreEqual("Pubnub Messaging API 1", strMessage);
TestComplete();
});
});
}
示例8: TestStuffcanDecryption
public void TestStuffcanDecryption()
{
ThreadPool.QueueUserWorkItem((s) =>
{
PubnubCrypto pc = new PubnubCrypto("enigma");
//deserialized string
string strMessage = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF";
//decrypt
string dec = pc.decrypt(strMessage);
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
Assert.AreEqual("{\"this stuff\":{\"can get\":\"complicated!\"}}", dec);
TestComplete();
});
});
}
示例9: TestGermanCharsDecryption
public void TestGermanCharsDecryption()
{
PubnubCrypto pc = new PubnubCrypto("enigma");
string strMessage = "stpgsG1DZZxb44J7mFNSzg==";
//decrypt
string dec = pc.decrypt(strMessage);
//deserialize
strMessage = (dec != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject<string>(dec) : "";
Assert.AreEqual("ÜÖ", strMessage);
}
示例10: TestUnicodeCharsDecryption
public void TestUnicodeCharsDecryption()
{
PubnubCrypto pc = new PubnubCrypto("enigma");
string strMessage = "+BY5/miAA8aeuhVl4d13Kg==";
//decrypt
string dec = pc.decrypt(strMessage);
//deserialize
strMessage = (dec != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject<string>(dec) : "";
Assert.AreEqual("漢語", strMessage);
}
示例11: TestHashDecryption
public void TestHashDecryption()
{
ThreadPool.QueueUserWorkItem((s) =>
{
PubnubCrypto pc = new PubnubCrypto("enigma");
//deserialized string
string strMessage = "GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=";
//decrypt
string dec = pc.decrypt(strMessage);
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
Assert.AreEqual("{\"foo\":{\"bar\":\"foobar\"}}", dec);
TestComplete();
});
});
}
示例12: TestPubNubDecryption2
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);
}
示例13: TestObjectDecryption
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);
}
示例14: TestUnicodeCharsDecryption
public void TestUnicodeCharsDecryption()
{
PubnubCrypto pc = new PubnubCrypto("enigma");
string strMessage= "+BY5/miAA8aeuhVl4d13Kg==";
//JavaScriptSerializer js = new JavaScriptSerializer();
//decrypt
string dec = pc.decrypt(strMessage);
//deserialize
strMessage= JsonConvert.DeserializeObject<string>(dec);
Assert.True(("漢語").Equals(strMessage));
}
示例15: TestGermanCharsDecryption
public void TestGermanCharsDecryption()
{
PubnubCrypto pc = new PubnubCrypto("enigma");
string strMessage= "stpgsG1DZZxb44J7mFNSzg==";
//JavaScriptSerializer js = new JavaScriptSerializer();
//decrypt
string dec = pc.decrypt(strMessage);
//deserialize
strMessage= JsonConvert.DeserializeObject<string>(dec);
Assert.True(("ÜÖ").Equals(strMessage));
}