Repository navigation
[release/6.0] Fix RSA OAEP decryption in Android with non-power-of-two key lengths - #71696
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones Issue DetailsCustomer ImpactA customer reported in #71607 that decrypting RSA OAEP with SHA2 and a 3072-bit key on Linux resulted in a OAEP de-padding error, while other platforms were able to perform these operations successfully. Investigation in to the issue led to uncover that RSA OAEP decryption that uses the managed implementation does not work with non-power-of-two keys because we do not slice a rented buffer accordingly. This issue was also present for Android, in addition to the reported platform, Linux. The current implementation only works because The fix is to slice the data to the correct size. .NET 7 will address this issue differently, by completely removing the managed RSA OEAP depadding in #71670, so this is not a back port. This is a port of dotnet/corefx#43153 for Android for release/6.0. TestingUnit tests were introduced to test RSA OAEP encryption with a 3072-bit RSA key. These tests will be forward-ported to dotnet/runtime@main. RiskMinimal. The change is localized and understood that a
|
|
Tagging subscribers to 'arch-android': @steveisok, @akoeplinger Issue DetailsCustomer ImpactA customer reported in #71607 that decrypting RSA OAEP with SHA2 and a 3072-bit key on Linux resulted in a OAEP de-padding error, while other platforms were able to perform these operations successfully. Investigation in to the issue led to uncover that RSA OAEP decryption that uses the managed implementation does not work with non-power-of-two keys because we do not slice a rented buffer accordingly. This issue was also present for Android, in addition to the reported platform, Linux. The current implementation only works because The fix is to slice the data to the correct size. .NET 7 will address this issue differently, by completely removing the managed RSA OEAP depadding in #71670, so this is not a back port. This is a port of dotnet/corefx#43153 for Android for release/6.0. TestingUnit tests were introduced to test RSA OAEP encryption with a 3072-bit RSA key. These tests will be forward-ported to dotnet/runtime@main. RiskMinimal. The change is localized and understood that a
|
13c327f to
c6d0ac3
Compare
Customer Impact
A customer reported in #71607 that decrypting RSA OAEP with SHA2 and a 3072-bit key on Linux resulted in a OAEP de-padding error, while other platforms were able to perform these operations successfully.
Investigation in to the issue led to uncover that RSA OAEP decryption that uses the managed implementation does not work with non-power-of-two keys because we do not slice a rented buffer accordingly. This issue was also present for Android, in addition to the reported platform, Linux. The current implementation only works because
CryptoPool.Renthappens to give back power-of-two arrays which are exactly the same size as the key.The fix is to slice the data to the correct size.
.NET 7 will address this issue differently, by completely removing the managed RSA OEAP depadding in #71670, so this is not a back port.
This is a port of dotnet/corefx#43153 for Android for release/6.0.
Testing
Unit tests were introduced to test RSA OAEP encryption with a 3072-bit RSA key. These tests will be forward-ported to dotnet/runtime@main.
Risk
Minimal. The change is localized and understood that a
Slicewas missing.