Skip to content

Instantly share code, notes, and snippets.

@tanglebones
Last active December 17, 2015 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanglebones/5549882 to your computer and use it in GitHub Desktop.
Save tanglebones/5549882 to your computer and use it in GitHub Desktop.
Computing the signature for an s3 policy
static string ComputeSignature(string policyEncoded, string privateKey)
{
using (var hmac = new HMACSHA1(Encoding.UTF8.GetBytes(privateKey), true))
{
return Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(policyEncoded)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment