Skip to content

Instantly share code, notes, and snippets.

@xli
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save xli/205bf9f7e530981f5666 to your computer and use it in GitHub Desktop.
Save xli/205bf9f7e530981f5666 to your computer and use it in GitHub Desktop.
Sign multipart upload request headers string sent by EvaporateJS with s3 multipart upload secret access key generated early
# in a Rails controller action
string_to_sign = params["to_sign"]
encoded = Base64.encode64(
OpenSSL::HMAC.digest(
OpenSSL::Digest::Digest.new("sha1"),
ENV["S3_MULTIPART_UPLOAD_SECRET_ACCESS_KEY"],
string_to_sign)).gsub("\n","")
render :text => encoded, :status => 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment