Exemplo n.º 1
0
 /**
  * Solves a certain challenge.
  *
  * Return false if not possible.
  *
  * @param Challenge $challenge
  * @param \stdClass $payload
  *
  * @return bool
  */
 public function solve(Challenge $challenge, $payload)
 {
     $this->challenge = $challenge;
     $this->payload = $payload;
     $this->token = $payload->token;
     $httpFeedback = $this->acme()->generateHttp01Payload($this->token);
     if (file_put_contents(static::$challenge_public_path . '/' . $this->token, $httpFeedback) === false) {
         return false;
     }
     $this->acme()->selfVerify($challenge->getHostname(), $this->token, $httpFeedback);
     $this->acme()->answerChallenge($payload->uri, $httpFeedback);
     $this->acme()->pollForChallenge($challenge->getLocation());
     unlink(static::$challenge_public_path . '/' . $this->token);
     return true;
 }