I have used this successfully:
public Boolean ValidateSignature(String method, Uri url) { String normalizedUrl, normalizedRequestParameters; List<QueryParameter> parameters = new List<QueryParameter>(); parameters.AddRange(GetQueryParameters(url.Query)); var sigParam = parameters.Find(p => p.Name == OAuthSignatureKey); if (sigParam == null) return false; var expected = sigParam.Value; parameters.Remove(parameters.Find(p => p.Name == OAuthSignatureKey)); parameters.Sort(new QueryParameterComparer()); normalizedUrl = string.Format("{0}://{1}", url.Scheme, url.Host); if (!((url.Scheme == "http" && url.Port == 80) || (url.Scheme == "https" && url.Port == 443))) { normalizedUrl += ":" + url.Port; } normalizedUrl += url.AbsolutePath; normalizedRequestParameters = NormalizeRequestParameters(parameters); StringBuilder signatureBase = new StringBuilder(); signatureBase.AppendFormat("{0}&", method.ToUpper()); signatureBase.AppendFormat("{0}&", UrlEncode(normalizedUrl)); signatureBase.AppendFormat("{0}", UrlEncode(normalizedRequestParameters)); HMACSHA1 hmacsha1 = new HMACSHA1(); hmacsha1.Key = Encoding.ASCII.GetBytes(string.Format("{0}&{1}", UrlEncode(ConsumerSecret), ""));
along with the code you can find here: http://oauth.googlecode.com/svn/code/csharp/OAuthBase.cs
EDIT : when making requests and sending parameters via get or post, this did not work. It seems that the problem is that Gmail sorts the parameters with capital letters first. I used only lowercase options, but you could easily fix the code to make sure the lowercase is in upper case.
source share