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

Fix potential overriding of cipher by other libraries #3751

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

BoomEaro
Copy link
Contributor

This pull request forces the use of specific RSA options, i.e. ECB and PKCS1Padding for cipher.
Specifying "RSA" without specific options will use the default options described above, however libraries such as BouncyCastle provided by various plugins may override this behavior, making it impossible to compare the secret correctly.

In this particular case, the default "RSA" implementation in BouncyCastle uses the following options "RSA/ECB/NoPadding", which results in any secret being impossible to compare, since the padding is not removed from it.

I also considered forcing the "SunJCE" provider in cipher, which also fixes this issue, however I think it is better to allow other libraries to influence this behavior, especially if it can improve performance.

In addition, this pull request also replaces the use of Arrays#equals with MessageDigest#isEqual which should have a positive impact on security.

@md-5 md-5 merged commit 01a5f36 into SpigotMC:master Sep 29, 2024
4 checks passed
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