Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RS256 segmentation fault #27

Open
riquebrenner opened this issue Apr 8, 2019 · 4 comments
Open

RS256 segmentation fault #27

riquebrenner opened this issue Apr 8, 2019 · 4 comments

Comments

@riquebrenner
Copy link

Greetings! I am trying to use RSA but SF (segmentation fault) is occurring.

I am creating a private key with this command:
"openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits: 1024"

and a public key with this command:
"openssl rsa -pubout -in private_key.pem -out public_key.pem"

and I'm using these functions:

$privateKey = file_get_contents ('private_key.pem');
$publicKey = file_get_contents ('public_key');
$retVal['Bearer'] = jwt_encode($payload, $privateKey, 'RS256');
$open_token = jwt_decode ($token, $publicKey, ['algorithm' => 'RS256']);

I walked step-by-step in the code, the values are generated, but further ahead in the code happens the segmentation failure. Am I doing something wrong?
I'm using CentOS 7, PHP 7.3 and mariaDB through the mysqli module.
When I use HS256 it runs ok.

@cdoco
Copy link
Owner

cdoco commented Apr 9, 2019

I did not reproduce this problem in PHP 7.3.

What's version of openssl?

@riquebrenner
Copy link
Author

Good morning, the version is 1.0.2k

@cdoco
Copy link
Owner

cdoco commented Apr 11, 2019

openssl 1.0.2k seems to be problematic, and it is recommended to upgrade to version 1.1.0j or more.

@riquebrenner
Copy link
Author

Excuse me, I am now using a Debian 9.8 server with apache 2.4.25, php 7.3.3 and the JWT library compiled with openssl 1.1.1b and I still get segmentation failure messages. I'm studying how to put the jwt library in debug mode so I get a stack-trace and send it to verify. Do you have any suggestion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants