简体   繁体   English

Laravel openssl_private_encrypt():密钥参数不是有效的私钥

[英]Laravel openssl_private_encrypt(): key param is not a valid private key

I am trying to connect to Chef API with Laravel using PHP-Chef . 我正在尝试使用PHP-Chef使用Laravel连接到Chef API。 I have tried to set up my chef config with the data that I got from knife.rb in .chef folder. 我尝试使用从.chef文件夹中的knife.rb获取的数据来设置我的厨师配置。 I have setup client and a key according to the instructions from Knife.rb . 根据Knife.rb的说明,我已经设置了客户端和密钥。 But I get: 但是我得到:

openssl_private_encrypt(): key param is not a valid private key

And in my controller when I do dd($this->key) I get null in return. 在我的控制器中,当我执行dd($this->key) ,会得到null。 This is my controller: 这是我的控制器:

protected $server;
protected $client;
protected $key;
protected $version;

public function ___construct()
{
  $this->server = config('chef.server');
  $this->client = config('chef.client');
  $this->key = config('chef.key');
  $this->version = config('chef.version');
}

/**
 * Get all dns records
 */
public function index()
{
  dd($this->key);
  $chef = new Chef($this->server, $this->client, $this->key, $this->version);

  // API request
  $response = $chef->get('/');
  dd($response);
}

And this is my config chef.php 这是我的配置Chef.php

return [
'server'    => 'https://172.16.0.227:443/organizations/myOrganizationsName',
'client'    => 'chef-validator',
'key'       => '/Users/myName/.chef/ORGANIZATION-validator.pem',
'version'   => '12.7.0',
"enterprise" => false
];

因为我想这是对的,所以只是将其复制下来以作答,但这听起来像是错误的密钥路径或文件权限,以致PHP无法读取密钥数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM