File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 77use SimpleSAML \XMLSecurity \Constants as C ;
88use SimpleSAML \XMLSecurity \Exception \InvalidArgumentException ;
99use SimpleSAML \XMLSecurity \Exception \OpenSSLException ;
10+ use SimpleSAML \XMLSecurity \Exception \RuntimeException ;
1011use SimpleSAML \XMLSecurity \Key \AsymmetricKey ;
1112use SimpleSAML \XMLSecurity \Key \KeyInterface ;
1213use SimpleSAML \XMLSecurity \Key \PrivateKey ;
@@ -158,6 +159,9 @@ public function decrypt(
158159 $ options = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING ;
159160 if ($ this ->useAuthTag ) { // configure GCM mode
160161 $ authTag = substr ($ ciphertext , - self ::AUTH_TAG_LEN );
162+ if (strlen ($ authTag ) !== self ::AUTH_TAG_LEN {
163+ throw new RuntimeException ('Authentication tag length is invalid ' );
164+ }
161165 $ ciphertext = substr ($ ciphertext , 0 , - self ::AUTH_TAG_LEN );
162166 $ options = OPENSSL_RAW_DATA ;
163167 }
You can’t perform that action at this time.
0 commit comments