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

STATUS_UNSUCCESSFUL in RsaCryptRoundtrip_OaepSHA1 #29683

Open
danmoseley opened this issue May 28, 2019 · 58 comments
Open

STATUS_UNSUCCESSFUL in RsaCryptRoundtrip_OaepSHA1 #29683

danmoseley opened this issue May 28, 2019 · 58 comments
Labels
area-System.Security Known Build Error Use this to report build issues in the .NET Helix tab tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly
Milestone

Comments

@danmoseley
Copy link
Member

danmoseley commented May 28, 2019

Not actionable as is.
https://mc.dot.net/#/user/dotnet-bot/pr~2Fdotnet~2Fcorefx~2Frefs~2Fpull~2F37960~2Fmerge/test~2Ffunctional~2Fcli~2Finnerloop~2F/20190528.20/workItem/System.Security.Cryptography.Cng.Tests/analysis/xunit/System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span~2FRsaCryptRoundtrip_OaepSHA1

Windows.10.Amd64.ClientRS4.ES.Open-x86-Release
Get Repro environment
Unhandled Exception of Type Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException
Message :
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)
Stack Trace :
   at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan`1 input, Span`1 output, AsymmetricPaddingMode paddingMode, Void* paddingInfo, Boolean encrypt, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 266
   at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Boolean encrypt, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 205
   at System.Security.Cryptography.RSACng.TryDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 38
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.<>c__DisplayClass1_0.<Decrypt>b__0(Byte[] dest) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.TryWithOutputArray(Func`2 func) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 23
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.Decrypt(RSA rsa, Byte[] data, RSAEncryptionPadding padding) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip(RSAEncryptionPadding paddingMode, Boolean expectSuccess) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 315
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip_OaepSHA1() in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 285

UPD by @CarnaViire: I went ahead and added Build Information below, from the last occurrence on my PR -- in hopes that known-issues infra would be able to validate and attach the failures not attached yet.

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=565017&view=results
Build error leg or test failing: System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.RsaCryptRoundtrip_OaepSHA512
Pull request:

Error Message

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

{
  "ErrorMessage": "CryptographicException : Unknown error (0x",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Report

Build Definition Test Pull Request
876783 dotnet/runtime System.Security.Cryptography.X509Certificates.Tests.DynamicChainTests.BasicConstraints_ExceedMaximumPathLength #110020

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 1 1

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=565017
Error message validated: [CryptographicException : Unknown error (0x]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 2/19/2024 11:07:21 AM UTC

@danmoseley
Copy link
Member Author

Correction, 0xC0000001 (STATUS_UNSUCCESSFUL) not an AV.

@danmoseley danmoseley changed the title AV in RsaCryptRoundtrip_OaepSHA1 STATUS_UNSUCCESSFUL in RsaCryptRoundtrip_OaepSHA1 May 28, 2019
@bartonjs
Copy link
Member

Oh, the joys of status codes. What's wrong? (UNSUCCESSFUL.) Where? Beats me.

@bartonjs
Copy link
Member

Without a stable (or "try this in a loop 30 times") repro or a TTT trace it's hard to bring this up with Windows. Since it's not really actionable right now, marking as Future.

@stephentoub
Copy link
Member

Again here:
https://mc.dot.net/#/user/dotnet-bot/pr~2Fdotnet~2Fcorefx~2Frefs~2Fpull~2F39369~2Fmerge/test~2Ffunctional~2Fcli~2F~2F/20190710.34/workItem/System.Security.Cryptography.Cng.Tests/analysis/xunit/System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span~2FRsaCryptRoundtrip_OaepSHA512

Windows.10.Amd64.ClientRS4.ES.Open-x64-Debug
Get Repro environment
Unhandled Exception of Type Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException
Message :
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)
Stack Trace :
   at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan`1 input, Span`1 output, AsymmetricPaddingMode paddingMode, Void* paddingInfo, Boolean encrypt, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 268
   at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Boolean encrypt, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 205
   at System.Security.Cryptography.RSACng.TryDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 38
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.<>c__DisplayClass1_0.<Decrypt>b__0(Byte[] dest) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.TryWithOutputArray(Func`2 func) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 23
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.Decrypt(RSA rsa, Byte[] data, RSAEncryptionPadding padding) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip(RSAEncryptionPadding paddingMode, Boolean expectSuccess) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 332
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip_OaepSHA512() in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 314

@dtivel
Copy link

dtivel commented Aug 1, 2019

We've hit this issue in several NuGet CI test runs.

@ViktorHofer
Copy link
Member

failed again: https://dev.azure.com/dnceng/public/_build/results?buildId=364160&view=ms.vss-test-web.build-test-results-tab&runId=11018888&resultId=100000&paneView=debug

Configuration: netcoreapp-Windows_NT-Debug-x64-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-61052b7-20190723211353

System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.RsaCryptRoundtrip_OaepSHA1 [FAIL]
      Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)
      Stack Trace:
        /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs(268,0): at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan`1 input, Span`1 output, AsymmetricPaddingMode paddingMode, Void* paddingInfo, Boolean encrypt, Int32& bytesWritten)
        /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs(205,0): at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Boolean encrypt, Int32& bytesWritten)
        /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs(38,0): at System.Security.Cryptography.RSACng.TryDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Int32& bytesWritten)
        /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs(16,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.<>c__DisplayClass1_0.<Decrypt>b__0(Byte[] dest)
        /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs(23,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.TryWithOutputArray(Func`2 func)
        /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs(16,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.Decrypt(RSA rsa, Byte[] data, RSAEncryptionPadding padding)
        /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs(332,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip(RSAEncryptionPadding paddingMode, Boolean expectSuccess)
        /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs(302,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip_OaepSHA1()

@bartonjs can you please take a look? A dump is available.

@bartonjs
Copy link
Member

@ViktorHofer I don't see a dump... the test simply failed.

Looking at history on the message over the past 90 days, it looks like one pops up every week or so (sometimes sooner); but there's no real trend (other than it's private key operations (decrypt, sign)).

I think I'm willing to do an experimental retry-once on this error and see if problems go away, now that there's longer to measure it and decide it didn't work or was otherwise a bad idea.

@ViktorHofer
Copy link
Member

Oh I must have mixed two builds up, you are right, there's no dump :(

I think I'm willing to do an experimental retry-once on this error and see if problems go away

You mean retrying that operation with the RetryHelper?

@bartonjs
Copy link
Member

You mean retrying that operation with the RetryHelper?

No. Making the product code call the Win32 function again if it returns STATUS_UNSUCCESSFUL.

@ViktorHofer
Copy link
Member

Trying that out doesn't sound like a bad idea.

@ViktorHofer
Copy link
Member

@bartonjs
Copy link
Member

Sounds like we'll be reverting the retry, then, and that there's very little we can do about it.

@ericstj
Copy link
Member

ericstj commented Jul 11, 2020

Again here: https://dev.azure.com/dnceng/public/_build/results?buildId=725147&view=ms.vss-test-web.build-test-results-tab&runId=22467048&resultId=166891&paneView=debug in #39101

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)


Stack trace
   at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, ReadOnlySpan`1 hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize) in /_/src/libraries/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs:line 41
   at System.Security.Cryptography.RSAImplementation.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs:line 82
   at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 175
   at System.Security.Cryptography.RSA.SignData(Byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 153
   at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs:line 22
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 690
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, Byte[] serialNumber) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 577
   at System.Security.Cryptography.X509Certificates.CertificateRequest.CreateSelfSigned(DateTimeOffset notBefore, DateTimeOffset notAfter) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 314
   at System.Security.Cryptography.X509Certificates.Tests.CertificateCreation.CertificateRequestChainTests.CreateAndTestChain(AsymmetricAlgorithm rootPrivKey, AsymmetricAlgorithm intermed1PrivKey, AsymmetricAlgorithm intermed2PrivKey, AsymmetricAlgorithm leafPubKey) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/CertificateRequestChainTests.cs:line 391
   at System.Security.Cryptography.X509Certificates.Tests.CertificateCreation.CertificateRequestChainTests.CreateChain_RSA() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/CertificateCreation/CertificateRequestChainTests.cs:line 42

@v-haren
Copy link

v-haren commented Jul 14, 2020

failed again in job: runtime-libraries outerloop 20200713.2

Error message

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)


Stack trace
   at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, ReadOnlySpan`1 hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize) in /_/src/libraries/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs:line 44
   at System.Security.Cryptography.RSAImplementation.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs:line 67
   at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 170
   at System.Security.Cryptography.RSA.SignData(Byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 150
   at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs:line 22
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 690
   at System.Security.Cryptography.X509Certificates.CertificateRequest.CreateSelfSigned(DateTimeOffset notBefore, DateTimeOffset notAfter) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 337
   at System.Security.Cryptography.X509Certificates.Tests.Common.CertificateAuthority.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject, String subjectName, Int32 keySize, X509ExtensionCollection extensions) in /_/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs:line 919
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1269
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootRevocationOffline(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 644

@BruceForstall
Copy link
Member

@bartonjs Given this failure is occurring now, should it still be in milestone "Future"?

@bartonjs bartonjs added the tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly label Jul 14, 2020
@bartonjs
Copy link
Member

@BruceForstall There's nothing we can do about it, it's a problem in the OS (possibly resource exhaustion?).

@v-haren
Copy link

v-haren commented Aug 20, 2020

failed again in job: runtime-libraries outerloop 20200819.2

failed test: System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeRoot(pkiOptions: IssuerRevocationViaOcsp | AllEndEntityRevocation | IssuerAuthorityHasDesignatedOcspResponder | RootAuthorityHasDesignatedOcspResponder)

net5.0-Windows_NT-Release-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504

Error message

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)


Stack trace
   at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, ReadOnlySpan`1 hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize) in /_/src/libraries/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs:line 44
   at System.Security.Cryptography.RSAImplementation.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs:line 98
   at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 170
   at System.Security.Cryptography.RSA.SignData(Byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 150
   at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs:line 22
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 692
   at System.Security.Cryptography.X509Certificates.CertificateRequest.CreateSelfSigned(DateTimeOffset notBefore, DateTimeOffset notAfter) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 338
   at System.Security.Cryptography.X509Certificates.Tests.Common.CertificateAuthority.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject, String subjectName, Int32 keySize, X509ExtensionCollection extensions) in /_/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs:line 926
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1344
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1292
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeRoot(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 175

@v-haren
Copy link

v-haren commented Aug 31, 2020

failed again in job: runtime-libraries outerloop 20200830.4

net5.0-Windows_NT-Release-x86-CoreCLR_release-Windows.10.Amd64.ServerRS5.Open

Error message

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)


Stack trace
   at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, ReadOnlySpan`1 hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize) in /_/src/libraries/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs:line 44
   at System.Security.Cryptography.RSAImplementation.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs:line 67
   at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 170
   at System.Security.Cryptography.RSA.SignData(Byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 150
   at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs:line 22
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 692
   at System.Security.Cryptography.X509Certificates.CertificateRequest.CreateSelfSigned(DateTimeOffset notBefore, DateTimeOffset notAfter) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 337
   at System.Security.Cryptography.X509Certificates.Tests.Common.CertificateAuthority.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject, String subjectName, Int32 keySize, X509ExtensionCollection extensions) in /_/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs:line 926
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1344
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1292
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEverything(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 283

@v-haren
Copy link

v-haren commented Sep 10, 2020

failed again in job: runtime-libraries-coreclr outerloop 20200909.3

failed test: System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeRoot(pkiOptions: AllRevocation | IssuerAuthorityHasDesignatedOcspResponder | RootAuthorityHasDesignatedOcspResponder)

net5.0-Windows_NT-Release-x86-CoreCLR_release-Windows.10.Amd64.ServerRS5.Open

Error message

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)


Stack trace
   at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, ReadOnlySpan`1 hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize) in /_/src/libraries/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs:line 44
   at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs:line 67
   at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 170
   at System.Security.Cryptography.RSA.SignData(Byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs:line 150
   at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs:line 22
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 692
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X509Certificate2 issuerCertificate, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 500
   at System.Security.Cryptography.X509Certificates.Tests.Common.CertificateAuthority.CreateCertificate(String subject, RSA publicKey, TimeSpan nestingBuffer, X509ExtensionCollection extensions, Boolean ocspResponder) in /_/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs:line 287
   at System.Security.Cryptography.X509Certificates.Tests.Common.CertificateAuthority.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject, String subjectName, Int32 keySize, X509ExtensionCollection extensions) in /_/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs:line 926
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1344
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1292
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeRoot(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 175

@VincentBu
Copy link
Contributor

Failed again in : runtime-libraries-coreclr outerloop 20220731.3

Failed test:

net7.0-Linux-Release-arm64-CoreCLR_release-(Ubuntu.2204.Arm64.Open)[email protected]/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8-20220504035342-1b9461f

- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | EndEntityRevocationViaOcsp)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: IssuerRevocationViaOcsp | AllEndEntityRevocation)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: OcspEverywhere)

Error message:

System.AggregateException : One or more errors occurred. (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1))
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)


Stack trace
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1543
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 458
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs:line 69
----- Inner Stack Trace #1 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #2 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #3 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #4 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #5 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67

@VincentBu
Copy link
Contributor

Failed again in: runtime-libraries-coreclr outerloop 20220801.5

Failed test:

net7.0-windows-Release-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504

- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntityWithInvalidRevocationSignature(pkiOptions: AllRevocation | IssuerAuthorityHasDesignatedOcspResponder | RootAuthorityHasDesignatedOcspResponder)

Error message:

System.Security.Cryptography.CryptographicException : Unknown error (0xc0000001)


Stack trace
   at System.Security.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, ReadOnlySpan`1 hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngCommon.SignVerify.cs:line 42
   at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs:line 83
   at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs:line 184
   at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs:line 22
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 685
   at System.Security.Cryptography.X509Certificates.CertificateRequest.CreateSelfSigned(DateTimeOffset notBefore, DateTimeOffset notAfter) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 322
   at System.Security.Cryptography.X509Certificates.Tests.Common.CertificateAuthority.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority[]& intermediateAuthorities, X509Certificate2& endEntityCert, Int32 intermediateAuthorityCount, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject, String subjectName, Int32 keySize, X509ExtensionCollection extensions) in /_/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs:line 905
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1594
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1543
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntityWithInvalidRevocationSignature(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 879
   at InvokeStub_DynamicRevocationTests.RevokeEndEntityWithInvalidRevocationSignature(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

@danmoseley
Copy link
Member Author

another example

System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Array.NonPowerOfTwoKeySizeOaepRoundtrip [[Console]](https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-74317-merge-9a6feaf6deb1423dab/System.Security.Cryptography.Cng.Tests/1/console.d1cb768f.log?helixlogtype=result) [[Details]](https://dev.azure.com/dnceng//public/_build/results?buildId=1957638&view=ms.vss-test-web.build-test-results-tab&runId=50313082&resultId=174500&paneView=debug) [[Artifacts]](https://dev.azure.com/dnceng//public/_build/results?buildId=1957638&view=ms.vss-test-web.build-test-results-tab&runId=50313082&resultId=174500&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab) [[0.02% failure rate]](https://dev.azure.com/dnceng//public/_build/results?buildId=1957638&view=ms.vss-test-web.build-test-results-tab&runId=50313082&resultId=174500&paneView=history)
Data Driven SubResults
❌ System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Array.NonPowerOfTwoKeySizeOaepRoundtrip(oaepPaddingMode: OaepSHA384)
Exception Message
System.Security.Cryptography.CryptographicException : Unknown error (0xc0000001)
Stack Trace
   at System.Security.Cryptography.RSACng.EncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan`1 input, AsymmetricPaddingMode paddingMode, Void* paddingInfo, Boolean encrypt) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 241
   at System.Security.Cryptography.RSACng.EncryptOrDecrypt(Byte[] data, RSAEncryptionPadding padding, Boolean encrypt) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 105
   at System.Security.Cryptography.RSACng.Decrypt(Byte[] data, RSAEncryptionPadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 25
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Array.Decrypt(RSA rsa, Byte[] data, RSAEncryptionPadding padding) in /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.NonPowerOfTwoKeySizeOaepRoundtrip(RSAEncryptionPadding oaepPaddingMode) in /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 687
   at InvokeStub_EncryptDecrypt.NonPowerOfTwoKeySizeOaepRoundtrip(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Failing Configuration
Windows.Nano.1809.Amd64.Open

@vcsjones vcsjones added the Known Build Error Use this to report build issues in the .NET Helix tab label Jan 12, 2023
@carlossanlop carlossanlop added Known Build Error Use this to report build issues in the .NET Helix tab and removed Known Build Error Use this to report build issues in the .NET Helix tab labels Aug 29, 2023
@ericstj
Copy link
Member

ericstj commented Oct 24, 2023

Another case:
https://helixre107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-93940-merge-c7413118c61b424dbc/System.Security.Cryptography.Tests/1/console.9c54d531.log?helixlogtype=result

    System.Security.Cryptography.X509Certificates.Tests.DynamicChainTests.BuildInvalidSignatureTwice(endEntityErrors: NotTimeValid | NotSignatureValid, intermediateErrors: NotTimeValid, rootErrors: NotTimeValid | UntrustedRoot) [FAIL]
      System.Security.Cryptography.CryptographicException : Unknown error (0xc1000001)
      Stack Trace:
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSABCrypt.cs(311,0): at System.Security.Cryptography.RSABCrypt.TrySignHash(ReadOnlySpan`1 hash, Span`1 destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, Int32& bytesWritten)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(626,0): at System.Security.Cryptography.RSA.SignHash(ReadOnlySpan`1 hash, Span`1 destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSABCrypt.cs(149,0): at System.Security.Cryptography.RSABCrypt.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(398,0): at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(376,0): at System.Security.Cryptography.RSA.SignData(Byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs(22,0): at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs(885,0): at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs(771,0): at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, Byte[] serialNumber)
        /_/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestDataGenerator.cs(150,0): at System.Security.Cryptography.X509Certificates.Tests.TestDataGenerator.MakeTestChain(ReadOnlySpan`1 keys, Span`1 certs, IEnumerable`1 endEntityExtensions, IEnumerable`1 intermediateExtensions, IEnumerable`1 rootExtensions, String testName)
        /_/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestDataGenerator.cs(32,0): at System.Security.Cryptography.X509Certificates.Tests.TestDataGenerator.MakeTestChain3(X509Certificate2& endEntityCert, X509Certificate2& intermediateCert, X509Certificate2& rootCert, IEnumerable`1 endEntityExtensions, IEnumerable`1 intermediateExtensions, IEnumerable`1 rootExtensions, String testName)
        /_/src/libraries/System.Security.Cryptography/tests/X509Certificates/DynamicChainTests.cs(79,0): at System.Security.Cryptography.X509Certificates.Tests.DynamicChainTests.BuildInvalidSignatureTwice(X509ChainStatusFlags endEntityErrors, X509ChainStatusFlags intermediateErrors, X509ChainStatusFlags rootErrors)
           at InvokeStub_DynamicChainTests.BuildInvalidSignatureTwice(Object, Span`1)
           at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

@build-analysis build-analysis bot removed this from the Future milestone Nov 15, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 15, 2023
@jeffhandley jeffhandley added this to the 9.0.0 milestone Nov 17, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Nov 17, 2023
@jeffhandley
Copy link
Member

We should take another look at this since it does occasionally cause CI to fail. Adding to the 9.0.0 milestone.

@jeffhandley
Copy link
Member

I chatted with @bartonjs about this and here are some notes:

  • Win32 has occasional crypto errors that we hit in CI, but we've not observed these in true product usage
  • Those errors lead to asymmetric crypto tests failing randomly
  • All of those failures end up getting correlated back to this issue
  • These are not actual .NET product or test issues
  • We've attempted using automatic retries, but that didn't address the CI issues
  • There's no product change to make here, and doing something to guard against this in all asymmetric tests would not be sensible

The best thing we could do is seek an approach of using an xUnit hook where we could apply an attribute to tests (or test classes) indicating, "if this test fails with an exception that looks like this, retry the test once". Such an approach, if feasible, would likely stop these CI failures.

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstressregs 20240303.1

Failed tests:

net9.0-windows-Release-x86-CoreCLR_checked-jitstressregs2-Windows.10.Amd64.Open
    - System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.NoFuzzyPkcs8

Error message:

 System.Security.Cryptography.CryptographicException : An internal error occurred.

Stack trace:

   at System.Security.Cryptography.CapiHelper.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Int32 keySize, SafeProvHandle safeProvHandle) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CapiHelper.Windows.cs:line 734
   at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeKeyHandle() in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs:line 134
   at System.Security.Cryptography.RSACryptoServiceProvider.ExportParameters(Boolean includePrivateParameters) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs:line 362
   at System.Security.Cryptography.RSA.ExportRSAPublicKey() in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs:line 713
   at System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.NoFuzzyPkcs8() in /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAKeyFileTests.cs:line 1002
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs:line 36
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Security Known Build Error Use this to report build issues in the .NET Helix tab tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly
Projects
None yet
Development

No branches or pull requests