Completed
Push — master ( 938edf...a23eff )
by Thijs
06:22
created
src/SAML2/Utils.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         }
247 247
 
248 248
         foreach ($namespaces as $prefix => $uri) {
249
-            $newElement->setAttributeNS($uri, $prefix . ':__ns_workaround__', 'tmp');
249
+            $newElement->setAttributeNS($uri, $prefix.':__ns_workaround__', 'tmp');
250 250
             $newElement->removeAttributeNS($uri, '__ns_workaround__');
251 251
         }
252 252
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             case 'true':
280 280
                 return true;
281 281
             default:
282
-                throw new \Exception('Invalid value of boolean attribute ' . var_export($attributeName, true) . ': ' . var_export($value, true));
282
+                throw new \Exception('Invalid value of boolean attribute '.var_export($attributeName, true).': '.var_export($value, true));
283 283
         }
284 284
     }
285 285
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
             $symKeyInfoAlgo = $symmetricKeyInfo->getAlgorith();
416 416
 
417 417
             if (in_array($symKeyInfoAlgo, $blacklist, true)) {
418
-                throw new \Exception('Algorithm disabled: ' . var_export($symKeyInfoAlgo, true));
418
+                throw new \Exception('Algorithm disabled: '.var_export($symKeyInfoAlgo, true));
419 419
             }
420 420
 
421 421
             if ($symKeyInfoAlgo === XMLSecurityKey::RSA_OAEP_MGF1P && $inputKeyAlgo === XMLSecurityKey::RSA_1_5) {
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
             /* Make sure that the input key format is the same as the one used to encrypt the key. */
432 432
             if ($inputKeyAlgo !== $symKeyInfoAlgo) {
433 433
                 throw new \Exception(
434
-                    'Algorithm mismatch between input key and key used to encrypt ' .
435
-                    ' the symmetric key for the message. Key was: ' .
436
-                    var_export($inputKeyAlgo, true) . '; message was: ' .
434
+                    'Algorithm mismatch between input key and key used to encrypt '.
435
+                    ' the symmetric key for the message. Key was: '.
436
+                    var_export($inputKeyAlgo, true).'; message was: '.
437 437
                     var_export($symKeyInfoAlgo, true)
438 438
                 );
439 439
             }
@@ -447,20 +447,20 @@  discard block
 block discarded – undo
447 447
                 /* To protect against "key oracle" attacks, we need to be able to create a
448 448
                  * symmetric key, and for that we need to know the key size.
449 449
                  */
450
-                throw new \Exception('Unknown key size for encryption algorithm: ' . var_export($symmetricKey->type, true));
450
+                throw new \Exception('Unknown key size for encryption algorithm: '.var_export($symmetricKey->type, true));
451 451
             }
452 452
 
453 453
             try {
454 454
                 $key = $encKey->decryptKey($symmetricKeyInfo);
455 455
                 if (strlen($key) != $keySize) {
456 456
                     throw new \Exception(
457
-                        'Unexpected key size (' . strlen($key) * 8 . 'bits) for encryption algorithm: ' .
457
+                        'Unexpected key size ('.strlen($key)*8.'bits) for encryption algorithm: '.
458 458
                         var_export($symmetricKey->type, true)
459 459
                     );
460 460
                 }
461 461
             } catch (\Exception $e) {
462 462
                 /* We failed to decrypt this key. Log it, and substitute a "random" key. */
463
-                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: ' . $e->getMessage());
463
+                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: '.$e->getMessage());
464 464
                 /* Create a replacement key, so that it looks like we fail in the same way as if the key was correctly padded. */
465 465
 
466 466
                 /* We base the symmetric key on the encrypted key and private key, so that we always behave the
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                 $encryptedKey = $encKey->getCipherValue();
470 470
                 $pkey = openssl_pkey_get_details($symmetricKeyInfo->key);
471 471
                 $pkey = sha1(serialize($pkey), true);
472
-                $key = sha1($encryptedKey . $pkey, true);
472
+                $key = sha1($encryptedKey.$pkey, true);
473 473
 
474 474
                 /* Make sure that the key has the correct length. */
475 475
                 if (strlen($key) > $keySize) {
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
             /* Make sure that the input key has the correct format. */
485 485
             if ($inputKeyAlgo !== $symKeyAlgo) {
486 486
                 throw new \Exception(
487
-                    'Algorithm mismatch between input key and key in message. ' .
488
-                    'Key was: ' . var_export($inputKeyAlgo, true) . '; message was: ' .
487
+                    'Algorithm mismatch between input key and key in message. '.
488
+                    'Key was: '.var_export($inputKeyAlgo, true).'; message was: '.
489 489
                     var_export($symKeyAlgo, true)
490 490
                 );
491 491
             }
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 
495 495
         $algorithm = $symmetricKey->getAlgorith();
496 496
         if (in_array($algorithm, $blacklist, true)) {
497
-            throw new \Exception('Algorithm disabled: ' . var_export($algorithm, true));
497
+            throw new \Exception('Algorithm disabled: '.var_export($algorithm, true));
498 498
         }
499 499
 
500 500
         /** @var string $decrypted */
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
          * namespaces needed to parse the XML.
507 507
          */
508 508
         $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" '.
509
-                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
510
-            $decrypted .
509
+                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.
510
+            $decrypted.
511 511
             '</root>';
512 512
 
513 513
         try {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
              * Something went wrong during decryption, but for security
547 547
              * reasons we cannot tell the user what failed.
548 548
              */
549
-            Utils::getContainer()->getLogger()->error('Decryption failed: ' . $e->getMessage());
549
+            Utils::getContainer()->getLogger()->error('Decryption failed: '.$e->getMessage());
550 550
             throw new \Exception('Failed to decrypt XML element.', 0, $e);
551 551
         }
552 552
     }
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
         $regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d+)?Z$/D';
709 709
         if (preg_match($regex, $time, $matches) == 0) {
710 710
             throw new \Exception(
711
-                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: ' . $time
711
+                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: '.$time
712 712
             );
713 713
         }
714 714
 
Please login to merge, or discard this patch.