I am using Base64.encode64 to create a hash from HMAC used in an API request (an API that I did not develop). The generated hashes sometimes included a "+". The requests that included the "+" fail. Requests without succeed.
The same kind of script in Python, for example, never has a "+" in the Base64 encoded hash.
Below are the two snippets. Again, the Python never has a "+", the Ruby sometimes does.
Any ideas what is going on? How can I keep Ruby's base64 encoding from using "+" characters?
Ruby:
hmac = OpenSSL::HMAC.digest('sha256', hmackey, request_string)
signature = URI::encode(Base64.encode64(hmac))
Python:
hmac = hmac.new(self.hmackey, urltosign, digestmod=hashlib.sha256).digest()
signature = base64.b64encode(hmac)