| Conditions | 6 |
| Paths | 11 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | public function __construct(string $crlData, X509Certificate ...$caCertificates) |
||
| 33 | { |
||
| 34 | $crl = new X509(); |
||
| 35 | foreach ($caCertificates as $ca) { |
||
| 36 | if ($crl->loadCA($ca->asDer()) === false) { |
||
| 37 | throw new ParseException('Failed to load CA certificate for CRL.'); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | $crlInfo = $crl->loadCRL($crlData); |
||
| 42 | if ($crlInfo === false) { |
||
|
|
|||
| 43 | throw new ParseException('Failed to load CRL data.'); |
||
| 44 | } |
||
| 45 | |||
| 46 | $nextUpdate = $crlInfo['tbsCertList']['nextUpdate']['utcTime'] ?? null; |
||
| 47 | if ($nextUpdate !== null) { |
||
| 48 | $this->nextUpdate = new DateTimeImmutable($nextUpdate, new DateTimeZone('UTC')); |
||
| 49 | } |
||
| 50 | |||
| 51 | if (true !== $crl->validateSignature()) { |
||
| 52 | throw new VerificationException('Failed to verify CRL signature.'); |
||
| 53 | } |
||
| 54 | $this->crl = $crl; |
||
| 55 | } |
||
| 67 |