php - Laravel openssl_private_encrypt(): key param is not a valid private key


Question: 

I am trying to connect to Chef API with Laravel using PHP-Chef. I have tried to set up my chef config with the data that I got from knife.rb in .chef folder. I have setup client and a key according to the instructions from 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. 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

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
];



1 Answer: 

Just copying this down to answer since I guess it was right, but this smells like a bad key path or file permissions such that PHP couldn't read the key data.

 

More Articles


android - How to return different code and error with MockRestAdapter

I use MockRestAdapter to return mock data in my tests, but I'd also like to test errors (401, 503, UnknownHostException, etc)For SocketTimeoutException, there's an API, but how about different response code?I've tried MockWebServer but no matter what I enqueue, I always get a 200 with the mock data

rust - How do I move multiple values out of a boxed value without calling clone?

This question already has an answer here: How to bind multiple fields of a boxed struct without getting “use moved value” error? 2 answers

c++ - Boost.Asio SSL thread safety

Do I create one strand that all of my SSL sockets share, or one strand per SSL context (shared by any associated sockets)?Boost.Asio SSL documentation states this, but it doesn't mention contexts. I assume that this means I must use only one strand for everything, but I think this was written before


data structures - Is there any practical usage of Doubly Linked List, Queues and Stacks?

I've been coding for quite sometime now. And my work pertains to solving real-world business scenarios. However, I have not really come across any practical usage of some of the data structures like the Linked List, Queues and Stacks etc.Not even at the business framework level. Of course, there is

php - Using json_decode on cURL result

I have got the following code that retrieves data about a company.function getSSLPage($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSLVERSION,1); curl_setopt($ch, CURLOPT_SSL_VERI

parsing - Parse JQ output through external bash function?

I want to parse out data out of a log file which consist of JSON sting and I wonder if there's a way for me to use a bash function to perform any custom parsing instead of overloading jq command.Command:tail errors.log --follow | jq --raw-output '. | [.server_name, .server_port, .request_file] | @ts


Know of any setup tutorials for SQL Server Express and C#?

I'm a C# and MySQL developer, but I'm looking into Microsoft's SQL Server for a new project. I'm familiar with MySQL syntax and the .NET connector. Does anyone know of any decent tutorials that just cover the code to interact with SQL Server? No C# basics or SQL basics, just how to get the two tec

libgit2sharp: how to set multiple values with same key

how do I set multiple values for a config-key? Some sections supports multiple values:[remote "origin"] url = git@github.com:schacon/simplegit-progit.git fetch = +refs/heads/master:refs/remotes/origin/master fetch = +refs/heads/qa/*:refs/remotes/origin/qa/*Something like this is not working in

r - split string at every character

I want to split every character in a string and output it as comma or tab separated characters:I need to use file_in and file_out since I have very many lines.inputTTTGGCTTTGTGCAATGG........outputT,T,T,G,G,CT,T,T,GT,G,C,A,A,T,G,GI have used this, but it prints every character vertically: /usr/bin/p

java - gRPC: Generate certificateChainFile and privateKeyFile to make TLS/SSL work

I want to make tls/ssl connection between client and server(Not mutual, one way). This is my setup:Server: Server server = ServerBuilder.forPort(8443) // Enable TLS .useTransportSecurity(certChainFile, privateKeyFile) .addService(new GreetingServiceImpl()) .build();Cli