Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
PHP: openssl_seal(): not a public key (1th member of pubkeys)

I am cloning a repo of a Laravel project. I clone the repo and do php artisan key: generate which correctly sets the keys in .env. However when the app makes an external API request, it fails with the error

openssl_seal(): not a public key (1th member of pubkeys)

I have checked and the env('API_KEY') and 'API_URL' variables are correct.

public static function request(string $url, $data = []): Response
{
    //This is where the code fails
    $encrypt_result = self::encrypt($data, env('API_KEY'));

    return Http::asForm()->post(env('API_URL') . $url, [
        'key' => env('API_KEY'),
        'hash' => $encrypt_result['hash'],
        'e_key' => $encrypt_result['key']
    ]);
}

public static function encrypt(array $data, string $public_key): array
{
    //This is where the code fails
    openssl_seal(json_encode($data), $encrypted, $e_keys, [base64_decode($public_key)]);

    return [
        'hash' => base64_encode($encrypted),
        'key' => base64_encode($e_keys[0])
    ];
}

I have previously seen questions that attribute this to an error with XAMPP, and I was using XAMPP on Windows though have subsequently replaced it with Wampserver and the issue persists.

While using Linux on this project fulltime is not viable, I will be testing it later.

Is there anything simple I might be overlooking?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The problem seems to be a Windows problem. Since you said it would run on Linux, I would move the application into a Linux docker container. You can containerize existing Laravel projects in a few steps. With Laravel Sail. The documentation explains it very well: https://laravel.com/docs/8.x/sail.

If there is no Sail in your composer.json, add it to composer require laravel/sail --dev.

But if you are familiar with docker-compose then just use docker plain without Laravel Sail.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!