public void Test_SignatureCompareWithSpaceInSignature() { OAuthParameters parameters = new OAuthParameters() { ConsumerKey = "key", Nonce = "5b434e59-729a-444b-9a11-2d8e57b1f2fb", SignatureMethod = "HMAC-SHA1", Timestamp = "1251983826", Version = "1.0", Callback = "http://yourownsite.com/" }; string sigbase = SignatureBase.Create( "GET", new Uri("http://localhost:3423/request-token.ashx"), parameters); string consumerSecret = "secret"; string tokenSecret = null; HmacSha1SigningProvider signingProvider = new HmacSha1SigningProvider(); Assert.That(signingProvider.SignatureMethod, Is.EqualTo("HMAC-SHA1")); string hash = signingProvider.ComputeSignature(sigbase, consumerSecret, tokenSecret); Assert.That(hash, Is.EqualTo("zHTiQHg8X5Lpkh+/0MSatKeNEFg=")); Assert.That(signingProvider.CheckSignature(sigbase, Rfc3986.Decode("zHTiQHg8X5Lpkh+/0MSatKeNEFg="), consumerSecret, tokenSecret), "Signature did not match"); }
public void Test_AuthCore1_0_AppendixA_5_2_Example() { string sigbase = "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal"; string consumerSecret = "kd94hf93k423kf44"; string tokenSecret = "pfkkdhi9sl3r4s00"; HmacSha1SigningProvider signingProvider = new HmacSha1SigningProvider(); Assert.That(signingProvider.SignatureMethod, Is.EqualTo("HMAC-SHA1")); string hash = signingProvider.ComputeSignature(sigbase, consumerSecret, tokenSecret); Assert.That(hash, Is.EqualTo("tR3+Ty81lMeYAr/Fid0kMTYa/WM=")); }