grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026setUpKeys(); } return file_get_contents($path); } /** * @return bool|string * @throws ApiException */ public function getPrivateKey() { $path = __DIR__.'/private.key'; if (!file_exists($path)) { $this->setUpKeys(); } return file_get_contents($path); } /** * @throws ApiException */ private function setUpKeys() { $config = array( 'digest_alg' => 'sha512', 'private_key_bits' => '2048', 'private_key_type' => OPENSSL_KEYTYPE_RSA, ); // Create the private and public key $resource = openssl_pkey_new($config); if ($resource === false) { throw new ApiException('[OAuth] Unable to generate private key'); } // Extract the private key from $res to $privKey openssl_pkey_export($resource, $privateKey); openssl_pkey_export_to_file($privateKey, __DIR__.'/private.key'); // Extract the public key from $res to $pubKey $publicKey = openssl_pkey_get_details($resource); if (!isset($publicKey['key'])) { throw new ApiException('[OAuth] Unable to generate public key'); } file_put_contents(__DIR__.'/public.key', $publicKey['key']); } }