aboutsummaryrefslogtreecommitdiffstats
path: root/redmine/hmac.diff
blob: 197960b79296f6214cd453b4bccb41646454dfc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--- usr/local/bundle/gems/ruby-openid-2.3.0/lib/openid/cryptutil.rb.old	2018-10-07 08:53:33.612724431 +0000
+++ usr/local/bundle/gems/ruby-openid-2.3.0/lib/openid/cryptutil.rb	2018-10-07 08:54:03.016525355 +0000
@@ -39,6 +39,6 @@
     def CryptUtil.hmac_sha1(key, text)
-      if Digest.const_defined? :HMAC
-        Digest::HMAC.new(key,Digest::SHA1).update(text).digest
+      if defined? OpenSSL
+        OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, key, text)
       else
         return HMAC::SHA1.digest(key, text)
       end
@@ -50,7 +50,7 @@
 
     def CryptUtil.hmac_sha256(key, text)
-      if Digest.const_defined? :HMAC
-        Digest::HMAC.new(key,Digest::SHA256).update(text).digest
+      if defined? OpenSSL
+        OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, text)
       else
         return HMAC::SHA256.digest(key, text)
       end