dotnet / dotnet/runtime

CryptographicException : An internal consistency check failed.

Open
#129,684 3 comments 0 reactions 0 assignees View on GitHub
area-System.Security Known Build Error
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Non-actionable Known Build Error. Windows CNG just internally erroring in a way we cannot diagnose.

**Error message:**
```
System.Security.Cryptography.CryptographicException : An internal consistency check failed.
```

**Stack trace:**
```
at System.Security.Cryptography.CngKey.Create(CngAlgorithm algorithm, String keyName, CngKeyCreationParameters creationParameters) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngKey.Create.cs:line 49
at System.Security.Cryptography.CngAlgorithmCore.GetOrGenerateKey(Int32 keySize, CngAlgorithm algorithm) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngAlgorithmCore.cs:line 73
at System.Security.Cryptography.RSACng.get_Key() in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACng.Key.cs:line 24
at System.Security.Cryptography.RSACng.ExportParameters(Boolean includePrivateParameters) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.ImportExport.cs:line 183
at System.Security.Cryptography.Rsa.Tests.RSAXml.FromToXml() in /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAXml.cs:line 989
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs:line 37
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57
```

### Known Issue Error Message

**DO NOT USE JSON BELOW IF THIS IS A BUILD BREAK** otherwise build analysis will allow pull requests to merge that break the build worse. For a build break, do not use this issue form. Make a regular new issue.

Fill the error message using [step by step known issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Build%20Analysis/KnownIssueJsonStepByStep.md).

```json
{
"ErrorMessage": "System.Security.Cryptography.CryptographicException : An internal consistency check failed.",
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}
```

### Known issue validation
**Build: :mag_right:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=1474245
**Error message validated:** `[System.Security.Cryptography.CryptographicException : An internal consistency check failed.`]
**Result validation:** :x: Known issue did not match with the provided build.
**Validation performed at:** 6/22/2026 3:29:49 PM UTC

### Report
#### Summary
|24-Hour Hit Count|7-Day Hit Count|1-Month Count|
|---|---|---|
|0|0|0|

Contributor guide

Open the contributing guide

Research direction

Start with the linked build and the RSAXml.FromToXml test at src/libraries/Common/tests/System.Security.Cryptography/AlgorithmImplementations/RSA/RSAXml.cs:989, then inspect the CngKey.Create and CngAlgorithmCore stack entries. Done means the Windows CNG failure is either diagnosed or the known-issue validation matches the supplied ErrorMessage; the issue provides no actionable fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cryptography, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.