Skip to content

Commit

Permalink
MDS lib free of deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Nov 17, 2023
1 parent 4daed3c commit 8075c4d
Showing 1 changed file with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,8 @@ private function validateCertificates(Certificate ...$certificates): bool
private function retrieveRevokedSerialNumbers(string $url): array
{
try {
if ($this->client instanceof HttpClientInterface) {
$crlData = $this->client->request('GET', $url)
->getContent();
} else {
$crlData = $this->sendPsrRequest($url);
}
$crlData = $this->client->request('GET', $url)
->getContent();
$crl = UnspecifiedType::fromDER($crlData)->asSequence();
count($crl) === 3 || throw CertificateRevocationListException::create($url);
$tbsCertList = $crl->at(0)
Expand Down Expand Up @@ -256,16 +252,4 @@ private function getCrlUrlList(Certificate $subject): array
);
}
}

private function sendPsrRequest(string $url): string
{
$request = $this->requestFactory->createRequest('GET', $url);
$response = $this->client->sendRequest($request);
if ($response->getStatusCode() !== 200) {
throw CertificateRevocationListException::create($url, 'Failed to download the CRL');
}

return $response->getBody()
->getContents();
}
}

0 comments on commit 8075c4d

Please sign in to comment.