| Conditions | 7 |
| Paths | 7 |
| Total Lines | 30 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 23 | public function findJWK(array $header) |
||
| 24 | { |
||
| 25 | if (!isset($header['x5u'])) { |
||
| 26 | return; |
||
| 27 | } |
||
| 28 | |||
| 29 | $content = $this->downloadContent($header['x5u']); |
||
| 30 | if (null === $content) { |
||
| 31 | return; |
||
| 32 | } |
||
| 33 | |||
| 34 | $content = json_decode($content, true); |
||
| 35 | if (!is_array($content)) { |
||
| 36 | return; |
||
| 37 | } |
||
| 38 | |||
| 39 | $jwk_set = ['keys']; |
||
| 40 | foreach ($content as $kid => $cert) { |
||
| 41 | $jwk = KeyConverter::loadKeyFromCertificate($cert); |
||
| 42 | if (null === $jwk) { |
||
| 43 | break; |
||
| 44 | } |
||
| 45 | if (is_string($kid)) { |
||
| 46 | $jwk['kid'] = $kid; |
||
| 47 | } |
||
| 48 | $jwk_set['keys'][] = $jwk; |
||
| 49 | } |
||
| 50 | |||
| 51 | return $jwk_set; |
||
| 52 | } |
||
| 53 | |||
| 79 |