Kelunik\AcmeClient\Stores\KeyStore::doGet PHP Method

doGet() private method

private doGet ( $path )
    private function doGet($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(sprintf("\$root must be of type string, %s given.", gettype($path)));
        }
        $file = $this->root . "/" . $path;
        $realpath = realpath($file);
        if (!$realpath) {
            throw new KeyStoreException("File not found: '{$file}'");
        }
        $privateKey = (yield \Amp\File\get($realpath));
        $res = openssl_pkey_get_private($privateKey);
        if ($res === false) {
            throw new KeyStoreException("Invalid private key: '{$file}'");
        }
        $publicKey = openssl_pkey_get_details($res)["key"];
        (yield new CoroutineResult(new KeyPair($privateKey, $publicKey)));
    }