fix: Use of RSA algorithm without OAEP #490
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Fix
This update enhances the security of RSA encryption and decryption operations by ensuring that OAEP padding is consistently used instead of PKCS1Padding.
The following changes have been made:
decryptAsymmetric
method inDecryptionHelper.java
ASYMMETRIC_CIPHER
constant with the explicit transformation string"RSA/ECB/OAEPWithSHA-1AndMGF1Padding"
.ASYMMETRIC_CIPHER
constant inYotiConstants.java
"RSA/NONE/OAEPWithSHA1AndMGF1Padding"
.ASYMMETRIC_CIPHER
across the codebase (including inDecryptionHelper.java
) use OAEP padding for RSA decryption by default.encryptAsymmetric
method inDecryptionHelper.java
ASYMMETRIC_CIPHER
constant with"RSA/ECB/OAEPWithSHA-1AndMGF1Padding"
.ASYMMETRIC_CIPHER
remain unchanged.Impact
These changes ensure that RSA encryption and decryption operations use OAEP padding, which provides better security properties and mitigates the risk of padding oracle attacks.
References
Mobile Security Testing Guide
The Padding Oracle Attack
CWE-780