Commit 8b06632

mo <mo.khan@gmail.com>
2017-11-26 18:36:47
extract ALGORITHMS contstants.
1 parent 820dfa8
Changed files (2)
lib/saml/kit/crypto/oaep_cipher.rb
@@ -2,12 +2,15 @@ module Saml
   module Kit
     module Crypto
       class OaepCipher
+        ALGORITHMS = {
+          'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' => true,
+        }
         def initialize(algorithm, key)
           @key = key
         end
 
         def self.matches?(algorithm)
-          'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' == algorithm
+          ALGORITHMS[algorithm]
         end
 
         def decrypt(cipher_text)
lib/saml/kit/crypto/rsa_cipher.rb
@@ -2,12 +2,16 @@ module Saml
   module Kit
     module Crypto
       class RsaCipher
+        ALGORITHMS = {
+          'http://www.w3.org/2001/04/xmlenc#rsa-1_5' => true,
+        }
+
         def initialize(algorithm, key)
           @key = key
         end
 
         def self.matches?(algorithm)
-          'http://www.w3.org/2001/04/xmlenc#rsa-1_5' == algorithm
+          ALGORITHMS[algorithm]
         end
 
         def decrypt(cipher_text)