@@ -2,7 +2,7 @@ module OneLogin
22 module RubySaml
33
44 # SAML2 Auxiliary class
5- #
5+ #
66 class Utils
77
88 DSIG = "http://www.w3.org/2000/09/xmldsig#"
@@ -30,7 +30,7 @@ def self.format_cert(cert)
3030 # @return [String] The formatted private key
3131 #
3232 def self . format_private_key ( key )
33- # don't try to format an encoded private key or if is empty
33+ # don't try to format an encoded private key or if is empty
3434 return key if key . nil? || key . empty? || key . match ( /\x0d / )
3535
3636 # is this an rsa key?
@@ -114,7 +114,7 @@ def self.decrypt_data(encrypted_node, private_key)
114114 { 'xenc' => XENC }
115115 )
116116 algorithm = encrypt_method . attributes [ 'Algorithm' ]
117- retrieve_plaintext ( node , symmetric_key , algorithm )
117+ retrieve_plaintext ( node , symmetric_key , algorithm )
118118 end
119119
120120 # Obtains the symmetric key from the EncryptedData element
@@ -134,7 +134,7 @@ def self.retrieve_symmetric_key(encrypt_data, private_key)
134134 { "ds" => DSIG , "xenc" => XENC }
135135 )
136136 algorithm = encrypt_method . attributes [ 'Algorithm' ]
137- retrieve_plaintext ( cipher_text , private_key , algorithm )
137+ retrieve_plaintext ( cipher_text , private_key , algorithm )
138138 end
139139
140140 # Obtains the deciphered text
@@ -152,7 +152,7 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
152152 when 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' then oaep = symmetric_key
153153 end
154154
155- if cipher
155+ if cipher
156156 iv_len = cipher . iv_len
157157 data = cipher_text [ iv_len ..-1 ]
158158 cipher . padding , cipher . key , cipher . iv = 0 , symmetric_key , cipher_text [ 0 ..iv_len -1 ]
@@ -167,6 +167,9 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
167167 end
168168 end
169169
170+ def self . uuid
171+ "_#{ SecureRandom . uuid } "
172+ end
170173 end
171174 end
172175end
0 commit comments