title: What is the C# equivalent of the Java SecretKeySpec
body: <p>I have following code written in Java</p>
  
  <pre><code>Mac mac = Mac.getInstance("HmacSHA1");
  String secretKey ="sKey";
  String content ="Hello";
  
  byte[] secretKeyBArr = secretKey.getBytes();    
  byte[] contentBArr = content.getBytes();
  
  SecretKeySpec secret_key = new SecretKeySpec(secretKeyBArr,"HmacSHA1");
  byte[] secretKeySpecArr = secret_key.getEncoded();
  
  mac.init(secret_key);
  
  byte[] final = mac.doFinal(contentBArr);
  </code></pre>
  
  <p>I want to make same example in C#. So, I wrote following code</p>
  
  <pre><code>HMACSHA1 hmacsha1 = new HMACSHA1();
  string secretKey = "sKey";
  string content = "Hello";
  
  byte[] secretKeyBArr = Encoding.UTF8.GetBytes(secretKey);
  byte[] contentBArr = Encoding.UTF8.GetBytes(content);
  
  hmacsha1.Key = secretKeyBArr;
  byte[] final = hmacsha1.ComputeHash(contentBArr);
  </code></pre>
  
  <p>Final results are not equal. secretKeyBArr and contentBArr are byte array and their values are same in both example. What is unknown is SecretKeySpec passed to mac.init(). So, what is equivalent same class in C#?</p>