title: Invalid Signature With OAuth 1.0 API
body: <p>I am working with an API that uses OAuth 1.0. There is no documentation on the website for the API other than it uses the standard method. I have followed the guide on the twitter site here <a href="https://dev.twitter.com/oauth/overview/creating-signatures" rel="nofollow">https://dev.twitter.com/oauth/overview/creating-signatures</a>. </p>
  
  <p>Everything seems to be good to me, but i keep getting a message telling me i have an invalid signature. I started with a class i found on github and i was getting the signature error. The class was massively complicated, so i wrote my own simple class (using C#). I have a constructor that correctly sets all the values being used here. Im 100% sure there is no missing data, the issue has to be with how the signature/request is being generated, but as far as i can see, everything was setup correctly. The output header looks correct and everything is populated. Any ideas what is wrong?</p>
  
  <pre><code>public string GenerateHeaderString(string url, string method)
  {
      string auth = "OAuth oauth_consumer_key=\"" + ConsumerKey + "\",oauth_token=\"" + HttpUtility.UrlEncode(Token) + "\",oauth_signature_method=\"" + SignatureMethod
          + "\",oauth_timestamp=\"" + Timestamp + "\",oauth_nonce=\"" + Nonce + "\",oauth_version=\"" + Version + "\",oauth_signature=\"" + GenerateSignature(url, method) + "\"";
      return auth;            
  }
  
  public string GenerateSignature(string url, string method)
  {
      string signature = method + "&amp;" + HttpUtility.UrlEncode(url) + "&amp;" + HttpUtility.UrlEncode("oauth_consumer_key=" + ConsumerKey
          + "&amp;oauth_nonce=" + Nonce + "&amp;oauth_signature_method=" + SignatureMethod + "&amp;oauth_timestamp="
          + Timestamp + "&amp;oauth_token=" + Token + "&amp;oauth_version=" + Version);
      switch(SignatureMethod)
      {
          case "HMAC-SHA1": 
              string keystring = string.Format("{0}&amp;{1}", HttpUtility.UrlEncode(this.ConsumerSecret),HttpUtility.UrlEncode(this.TokenSecret));
  
              var hmacsha1 = new HMACSHA1
              {
                  Key = System.Text.Encoding.ASCII.GetBytes(keystring)
              };
              byte[] dataBuffer = System.Text.Encoding.ASCII.GetBytes(signature);
              byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
  
              this.Signature = HttpUtility.UrlEncode(Convert.ToBase64String(hashBytes));
          break;
      }
      return this.Signature;
  }
  </code></pre>