1 | <?php |
||
10 | class SecurityHelper |
||
11 | { |
||
12 | |||
13 | const XMLDSIG_DIGEST_MD5 = 'http://www.w3.org/2001/04/xmldsig-more#md5'; |
||
14 | |||
15 | private static $typeMap = [ |
||
16 | 'RSA-SHA1' => XMLSecurityKey::RSA_SHA1, |
||
17 | 'RSA-SHA256' => XMLSecurityKey::RSA_SHA256, |
||
18 | 'RSA-SHA384' => XMLSecurityKey::RSA_SHA384, |
||
19 | 'RSA-SHA512' => XMLSecurityKey::RSA_SHA512, |
||
20 | ]; |
||
21 | |||
22 | public static $validEncryptionMethods = [ |
||
23 | XMLSecurityKey::TRIPLEDES_CBC, |
||
24 | // Prefered |
||
25 | XMLSecurityKey::AES128_CBC, |
||
26 | XMLSecurityKey::AES192_CBC, |
||
27 | XMLSecurityKey::AES256_CBC, |
||
28 | |||
29 | XMLSecurityKey::RSA_1_5, |
||
30 | XMLSecurityKey::RSA_SHA1, |
||
31 | XMLSecurityKey::RSA_OAEP_MGF1P, |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * @param string $certificate |
||
36 | * @return string |
||
37 | */ |
||
38 | public static function convertToCertificate(string $certificate) |
||
44 | |||
45 | /** |
||
46 | * @param string $certificate |
||
47 | * @return string|string[]|null |
||
48 | */ |
||
49 | public static function cleanCertificate(string $certificate) |
||
57 | |||
58 | /** |
||
59 | * @param string $certificate |
||
60 | * @return string|string[]|null |
||
61 | */ |
||
62 | public static function cleanCertificateWhiteSpace(string $certificate) |
||
66 | |||
67 | /** |
||
68 | * @param $pem |
||
69 | * @return mixed|string|null |
||
70 | * @throws \Exception |
||
71 | * Thank you lightsaml/lightsaml |
||
72 | */ |
||
73 | public static function getPemAlgorithm($pem) |
||
116 | |||
117 | /** |
||
118 | * @param EncryptedAssertion $encryptedAssertion |
||
119 | * @param $pemString |
||
120 | * @param array $blacklist |
||
121 | * @return \SAML2\Assertion |
||
122 | * @throws \Exception |
||
123 | */ |
||
124 | public static function decryptAssertion(EncryptedAssertion $encryptedAssertion, $pemString, array $blacklist = []) |
||
159 | } |
||
160 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.