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

Abstract CryptKey public methods to the CryptKeyInterface #1044

Merged
merged 6 commits into from
Aug 31, 2019

Conversation

erickskrauch
Copy link
Contributor

The library provides flexible storage for all possible types of entities but strictly adheres to the use of the RSA key written to the file for signing JWT tokens. Using RSA, the size of the signature is almost 3 times larger than the key itself, so I would prefer to use a different key and signature algorithm. But the current implementation of CryptKey sets a strict requirement for RSA.

Of course, I can extend from CryptKey and override the constructor, but this is a way of avoiding the problem rather than solving it.

This solution is BC, so I expect it to be available only in the 9.0.0 release. Anyway, I think we need a lot more abstraction on the keys (see #1007).

@Sephster
Copy link
Member

Thanks @erickskrauch. Out of interest, which signing mechanism were you looking to use instead? Can you provide some background as to the issues you are having with the size of the file at the moment? We've chosen this signing mechanism to keep things secure by default but happy to look at changing the library if this is causing real problems for people

@erickskrauch
Copy link
Contributor Author

@Sephster, ECDSA SHA-256. This algorithm provides a much shorter signature length (compare them on https://jwt.io). You can say that this is a bit saving, but if it can be optimized, I prefer this algorithm over RSA.

@Sephster
Copy link
Member

Thanks @erickskrauch. I can see why someone would want this. ECDSA is slower than RSA but does offer some space saving so I guess the implementer would have to weigh up the benefits/drawbacks. Seems like a good idea to include something like this. I will give it a full review soon. Cheers

Copy link
Member

@Sephster Sephster left a comment

Choose a reason for hiding this comment

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

Minor changes required around return statements. We will also need to have this merge to the v9 branch (which I haven't created yet). I'm happy to make these changes now to push this through but noting here for feedback.

src/CryptKey.php Outdated Show resolved Hide resolved
src/CryptKey.php Outdated Show resolved Hide resolved
tests/AuthorizationServerTest.php Outdated Show resolved Hide resolved
@Sephster Sephster changed the base branch from master to 9.0.0-WIP August 31, 2019 17:52
@Sephster Sephster merged commit 1ca1b68 into thephpleague:9.0.0-WIP Aug 31, 2019
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.

2 participants