@@ -295,6 +295,9 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
295295 when 'http://www.w3.org/2001/04/xmlenc#aes128-cbc' then cipher = OpenSSL ::Cipher . new ( 'AES-128-CBC' ) . decrypt
296296 when 'http://www.w3.org/2001/04/xmlenc#aes192-cbc' then cipher = OpenSSL ::Cipher . new ( 'AES-192-CBC' ) . decrypt
297297 when 'http://www.w3.org/2001/04/xmlenc#aes256-cbc' then cipher = OpenSSL ::Cipher . new ( 'AES-256-CBC' ) . decrypt
298+ when 'http://www.w3.org/2009/xmlenc11#aes128-gcm' then auth_cipher = OpenSSL ::Cipher . new ( 'AES-128-GCM' ) . decrypt
299+ when 'http://www.w3.org/2009/xmlenc11#aes192-gcm' then auth_cipher = OpenSSL ::Cipher . new ( 'AES-192-GCM' ) . decrypt
300+ when 'http://www.w3.org/2009/xmlenc11#aes256-gcm' then auth_cipher = OpenSSL ::Cipher . new ( 'AES-256-GCM' ) . decrypt
298301 when 'http://www.w3.org/2001/04/xmlenc#rsa-1_5' then rsa = symmetric_key
299302 when 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' then oaep = symmetric_key
300303 end
@@ -305,6 +308,16 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
305308 cipher . padding , cipher . key , cipher . iv = 0 , symmetric_key , cipher_text [ 0 ..iv_len -1 ]
306309 assertion_plaintext = cipher . update ( data )
307310 assertion_plaintext << cipher . final
311+ elsif auth_cipher
312+ iv_len , text_len , tag_len = auth_cipher . iv_len , cipher_text . length , 16
313+ data = cipher_text [ iv_len ..text_len -1 -tag_len ]
314+ auth_cipher . padding = 0
315+ auth_cipher . key = symmetric_key
316+ auth_cipher . iv = cipher_text [ 0 ..iv_len -1 ]
317+ auth_cipher . auth_data = ''
318+ auth_cipher . auth_tag = cipher_text [ text_len -tag_len ..-1 ]
319+ assertion_plaintext = auth_cipher . update ( data )
320+ assertion_plaintext << auth_cipher . final
308321 elsif rsa
309322 rsa . private_decrypt ( cipher_text )
310323 elsif oaep
0 commit comments