From 7a0558b5c16198a113b3702e6978e5f9702d000e Mon Sep 17 00:00:00 2001 From: Mark Burns Date: Sun, 29 Apr 2012 23:15:48 +0100 Subject: [PATCH] using OpenSSL instead of ruby-hmac gem --- lib/signature.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/signature.rb b/lib/signature.rb index ea62ba1..319aafc 100644 --- a/lib/signature.rb +++ b/lib/signature.rb @@ -1,4 +1,4 @@ -require 'hmac-sha2' +require 'openssl' module Signature class AuthenticationError < RuntimeError; end @@ -90,7 +90,11 @@ def auth_hash private def signature(token) - HMAC::SHA256.hexdigest(token.secret, string_to_sign) + OpenSSL::HMAC.hexdigest(digest, token.secret, string_to_sign) + end + + def digest + OpenSSL::Digest::Digest.new('sha256') end def string_to_sign