Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda