@@ -253,6 +253,9 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
253253 when 'http://www.w3.org/2001/04/xmlenc#aes128-cbc' then cipher = OpenSSL ::Cipher . new ( 'AES-128-CBC' ) . decrypt
254254 when 'http://www.w3.org/2001/04/xmlenc#aes192-cbc' then cipher = OpenSSL ::Cipher . new ( 'AES-192-CBC' ) . decrypt
255255 when 'http://www.w3.org/2001/04/xmlenc#aes256-cbc' then cipher = OpenSSL ::Cipher . new ( 'AES-256-CBC' ) . decrypt
256+ when 'http://www.w3.org/2009/xmlenc11#aes128-gcm' then auth_cipher = OpenSSL ::Cipher . new ( 'AES-128-GCM' ) . decrypt
257+ when 'http://www.w3.org/2009/xmlenc11#aes192-gcm' then auth_cipher = OpenSSL ::Cipher . new ( 'AES-192-GCM' ) . decrypt
258+ when 'http://www.w3.org/2009/xmlenc11#aes256-gcm' then auth_cipher = OpenSSL ::Cipher . new ( 'AES-256-GCM' ) . decrypt
256259 when 'http://www.w3.org/2001/04/xmlenc#rsa-1_5' then rsa = symmetric_key
257260 when 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' then oaep = symmetric_key
258261 end
@@ -263,6 +266,16 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
263266 cipher . padding , cipher . key , cipher . iv = 0 , symmetric_key , cipher_text [ 0 ..iv_len -1 ]
264267 assertion_plaintext = cipher . update ( data )
265268 assertion_plaintext << cipher . final
269+ elsif auth_cipher
270+ iv_len , text_len , tag_len = auth_cipher . iv_len , cipher_text . length , 16
271+ data = cipher_text [ iv_len ..text_len -1 -tag_len ]
272+ auth_cipher . padding = 0
273+ auth_cipher . key = symmetric_key
274+ auth_cipher . iv = cipher_text [ 0 ..iv_len -1 ]
275+ auth_cipher . auth_data = ''
276+ auth_cipher . auth_tag = cipher_text [ text_len -tag_len ..-1 ]
277+ assertion_plaintext = auth_cipher . update ( data )
278+ assertion_plaintext << auth_cipher . final
266279 elsif rsa
267280 rsa . private_decrypt ( cipher_text )
268281 elsif oaep
0 commit comments