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 ;
@@ -153,6 +154,9 @@ public function decrypt(
153154 $ options = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING ;
154155 if ($ this ->useAuthTag ) { // configure GCM mode
155156 $ authTag = substr ($ ciphertext , - self ::AUTH_TAG_LEN );
157+ if (strlen ($ authTag ) !== self ::AUTH_TAG_LEN {
158+ throw new RuntimeException ('Authentication tag length is invalid ' );
159+ }
156160 $ ciphertext = substr ($ ciphertext , 0 , - self ::AUTH_TAG_LEN );
157161 $ options = OPENSSL_RAW_DATA ;
158162 }
You can’t perform that action at this time.
0 commit comments