private function doRevokeCertificate($pem)
{
if (!is_string($pem)) {
throw new InvalidArgumentException(sprintf("\$pem must be of type string, %s given.", gettype($pem)));
}
$begin = "CERTIFICATE-----";
$end = "----END";
$pem = substr($pem, strpos($pem, $begin) + strlen($begin));
$pem = substr($pem, 0, strpos($pem, $end));
$enc = new Base64UrlSafeEncoder();
/** @var Response $response */
$response = (yield $this->acmeClient->post(AcmeResource::REVOKE_CERTIFICATE, ["certificate" => $enc->encode(base64_decode($pem))]));
if ($response->getStatus() === 200) {
(yield new CoroutineResult(true));
return;
}
throw $this->generateException($response);
}