PointyCastle / pointycastle

Moved into the Bouncy Castle project: https://github.com/bcgit/pc-dart
MIT License
270 stars 76 forks source link

OAEP bug fix for non-deterministically failing on decryption #218

Closed hoylen closed 4 years ago

hoylen commented 4 years ago

Bug fix for "RSA with OAEP fails nondeterministically" https://github.com/PointyCastle/pointycastle/issues/177 issue.

This also solves the mystery of the redundant code from Bouncy Castle. Bouncy Castle's RSA decryption method returns a new array and the code then copied it into a new block. Pointy Castle creates a block and passes it into the RSA decryption method to populate, so no copying was/is required. But the Bouncy Castle code does more than just copying the bytes: it is also taking care of the situation when the decrypted bytes is shorter than expected.

Note: the encryption code was correct. Only the decryption code had a bug.

AKushWarrior commented 4 years ago

https://github.com/bcgit/pc-dart

AKushWarrior commented 4 years ago

You might want to copy this PR over

hoylen commented 4 years ago

Closing this pull request.

It has been resubmitted on the new Pointy Castle repository as https://github.com/bcgit/pc-dart/pull/11