@@ -2,7 +2,7 @@ module OneLogin
2
2
module RubySaml
3
3
4
4
# SAML2 Auxiliary class
5
- #
5
+ #
6
6
class Utils
7
7
8
8
DSIG = "http://www.w3.org/2000/09/xmldsig#"
@@ -30,7 +30,7 @@ def self.format_cert(cert)
30
30
# @return [String] The formatted private key
31
31
#
32
32
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
34
34
return key if key . nil? || key . empty? || key . match ( /\x0d / )
35
35
36
36
# is this an rsa key?
@@ -114,7 +114,7 @@ def self.decrypt_data(encrypted_node, private_key)
114
114
{ 'xenc' => XENC }
115
115
)
116
116
algorithm = encrypt_method . attributes [ 'Algorithm' ]
117
- retrieve_plaintext ( node , symmetric_key , algorithm )
117
+ retrieve_plaintext ( node , symmetric_key , algorithm )
118
118
end
119
119
120
120
# Obtains the symmetric key from the EncryptedData element
@@ -134,7 +134,7 @@ def self.retrieve_symmetric_key(encrypt_data, private_key)
134
134
{ "ds" => DSIG , "xenc" => XENC }
135
135
)
136
136
algorithm = encrypt_method . attributes [ 'Algorithm' ]
137
- retrieve_plaintext ( cipher_text , private_key , algorithm )
137
+ retrieve_plaintext ( cipher_text , private_key , algorithm )
138
138
end
139
139
140
140
# Obtains the deciphered text
@@ -152,7 +152,7 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
152
152
when 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' then oaep = symmetric_key
153
153
end
154
154
155
- if cipher
155
+ if cipher
156
156
iv_len = cipher . iv_len
157
157
data = cipher_text [ iv_len ..-1 ]
158
158
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)
167
167
end
168
168
end
169
169
170
+ def self . uuid
171
+ "_#{ SecureRandom . uuid } "
172
+ end
170
173
end
171
174
end
172
175
end
0 commit comments