Class: RightAws::AwsUtils
Overview
:nodoc:
Constant Summary collapse
- @@digest =
OpenSSL::Digest::Digest.new("sha1")
Class Method Summary collapse
- .sign(aws_secret_access_key, auth_string) ⇒ Object
-
.URLencode(raw) ⇒ Object
From Amazon’s SQS Dev Guide, a brief description of how to escape: “URL encode the computed signature and other query parameters as specified in RFC1738, section 2.2.
Class Method Details
.sign(aws_secret_access_key, auth_string) ⇒ Object
30 31 32 |
# File 'lib/awsbase/right_awsbase.rb', line 30 def self.sign(aws_secret_access_key, auth_string) Base64.encode64(OpenSSL::HMAC.digest(@@digest, aws_secret_access_key, auth_string)).strip end |
.URLencode(raw) ⇒ Object
From Amazon’s SQS Dev Guide, a brief description of how to escape: “URL encode the computed signature and other query parameters as specified in RFC1738, section 2.2. In addition, because the + character is interpreted as a blank space by Sun Java classes that perform URL decoding, make sure to encode the + character although it is not required by RFC1738.” Avoid using CGI::escape to escape URIs. CGI::escape will escape characters in the protocol, host, and port sections of the URI. Only target chars in the query string should be escaped.
43 44 45 46 |
# File 'lib/awsbase/right_awsbase.rb', line 43 def self.URLencode(raw) e = URI.escape(raw) e.gsub(/\+/, "%2b") end |