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

System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.Decrypt_Pkcs1_ErrorsForInvalidPadding(Byte[] data) #99369

Closed
lewing opened this issue Mar 6, 2024 · 4 comments · Fixed by #99373
Labels
area-System.Security blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab

Comments

@lewing
Copy link
Member

lewing commented Mar 6, 2024

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=591354
Build error leg or test failing: System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_TrySpan.Decrypt_Pkcs1_ErrorsForInvalidPadding
Pull request: #99287

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.Decrypt_Pkcs1_ErrorsForInvalidPadding(Byte[] data)",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=591354
Error message validated: [at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.Decrypt_Pkcs1_ErrorsForInvalidPadding(Byte[] data)]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 3/6/2024 6:01:33 PM UTC

Report

Build Definition Test Pull Request
591354 dotnet/runtime System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_TrySpan.Decrypt_Pkcs1_ErrorsForInvalidPadding #99287
590185 dotnet/runtime System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.Decrypt_Pkcs1_ErrorsForInvalidPadding #99263

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
1 2 2
@lewing lewing added blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab labels Mar 6, 2024
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Mar 6, 2024
@ghost
Copy link

ghost commented Mar 6, 2024

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=591354
Build error leg or test failing: System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_TrySpan.Decrypt_Pkcs1_ErrorsForInvalidPadding
Pull request: #99287

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.Decrypt_Pkcs1_ErrorsForInvalidPadding(Byte[] data)",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}
Author: lewing
Assignees: -
Labels:

area-System.Security, blocking-clean-ci, Known Build Error

Milestone: -

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 6, 2024
@bartonjs
Copy link
Member

bartonjs commented Mar 6, 2024

I think this might be a one in a million failure... and we can probably delete the test because it's probably covered by tests added since that one.

Jeremy rambling about probability

OK, for a completely random input; the odds of a successful PKCS1 decryption are

  • First byte == 0x00: 1/256 (0.4%)
  • Second byte == 0x02: 1/256
  • Bytes [2] through [10] not being 0: POWER(255/256, 8) (~97%)
  • There's a 0x00 beyond [10]. 1 - POWER(255/256, len - 10).
    • This is a RSA2048 key, so len is 256, so len-10 is 246, so that comes out to about 62%
  • 9.14e-6
  • Invert that to get the 1-in-a number: 109385

That's for random. This is for derived. That changes the probability to... something. "What are the odds that modpow(x, n, d) and modpow(y, n, d) are both PKCS1-conforming when y2038 = ~x2038, y2037 = ~x2037, ... y2031 = ~x2031; otherwise yi = xi, and modpow(x, n, d) is pkcs-conforming?" Shrug, say one in a million, move on.

Bonus points to anyone who can actually work that out.

@lewing
Copy link
Member Author

lewing commented Mar 6, 2024

happened twice today

@vcsjones
Copy link
Member

vcsjones commented Mar 6, 2024

Clearly my test writing efforts would be better spent on buying lottery tickets.

@ghost ghost removed in-pr There is an active PR which will close this issue when it is merged untriaged New issue has not been triaged by the area owner labels Mar 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Security blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants