title: How to generate random key for HMACSHA256 signature calculation
body: <p>I need to calculate a signature of some strings and was planning on doing this like this:</p>
  
  <pre><code>using (HMACSHA256 hmacSha256 = new HMACSHA256( &lt;randombytes&gt;))
  {
           Byte[] dataToHmac = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
           signature = Convert.ToBase64String(hmacSha256.ComputeHash(dataToHmac));
  }
  </code></pre>
  
  <p>I am going to store the key together with my user data, but i am not sure if the randombytes can just be random or how to generate them in c#.</p>
  
  <p>What is the proper way to generate random keys?</p>