Skip to content

feat: Add support for PS256#637

Open
Hectorhammett wants to merge 1 commit into
mainfrom
ps256-algorithm
Open

feat: Add support for PS256#637
Hectorhammett wants to merge 1 commit into
mainfrom
ps256-algorithm

Conversation

@Hectorhammett
Copy link
Copy Markdown
Collaborator

closes: #579

@Hectorhammett Hectorhammett changed the title feature: Add support for PS256 feat: Add support for PS256 May 21, 2026
@Hectorhammett Hectorhammett requested a review from bshaffer May 21, 2026 20:37
Copy link
Copy Markdown
Collaborator

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! some minor suggestions is all I have

Comment thread src/JWT.php
Comment on lines +786 to +789
} elseif (!\is_string($key)) {
throw new DomainException(
'The key needs to be an instance of string|OpenSSLAsymmetricKey|OpenSSLCertificate.'
);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is unreachable -- the typehints are already defined, so anything that would evaluate true here would already have thrown a TypeError when this function is called.

Suggested change
} elseif (!\is_string($key)) {
throw new DomainException(
'The key needs to be an instance of string|OpenSSLAsymmetricKey|OpenSSLCertificate.'
);

Comment thread src/JWT.php
Comment on lines +828 to +831
} elseif (!\is_string($key)) {
throw new DomainException(
'The key needs to be an instance of string|OpenSSLAsymmetricKey|OpenSSLCertificate.'
);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - this validation block is unreachable

Suggested change
} elseif (!\is_string($key)) {
throw new DomainException(
'The key needs to be an instance of string|OpenSSLAsymmetricKey|OpenSSLCertificate.'
);

Comment thread README.md

### Note
PHP's OpenSSL extension does not support RSASSA-PSS signatures (PS256) by default, so we provide support via a soft dependency on the [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) library. It is necessary to install this library in your project if you plan to use PS256.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest adding a fenced codeblock here so it's harder to overlook:

composer install phpseclib/phpseclib:^3.0

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

Successfully merging this pull request may close these issues.

Request for PS256 Algorithm Support

2 participants