You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.NET SDK:
Version: 9.0.203
Commit: dc7acfa194
Workload version: 9.0.200-manifests.9df47798
MSBuild version: 17.13.20+a4ef1e90f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.203\
Host:
Version: 9.0.4
Architecture: x64
Commit: f57e6dc747
.NET SDKs installed:
9.0.203 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 9.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
As far as I understand, issue is specific for Windows.
Other information
On Windows CngKey for EC key marked with AlgorithmGroup ECDSA or ECDH. ECDH keys can be used in both algorithms, while ECDSA keys can be used only with ECDSA. As such when key should be usable in both algorithms, then it should be loaded as ECDH. Following code fragment load them as ECDSA:
Switch cases Oids.EcPublicKey when IsECDsa(certificate) and Oids.EcPublicKey when IsECDiffieHellman(certificate) should be reordered to load them as ECDH.
The text was updated successfully, but these errors were encountered:
Description
When certificate is both ECDSA and ECDH in terms of:
runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs
Lines 1285 to 1299 in 27604b5
Then private key loaded with
X509Certificate2.CreateFromPem
is not usable for ECDH on Windows.Reproduction Steps
Expected behavior
False
False
Actual behavior
False
True
Regression?
No response
Known Workarounds
Explicitly load private key with
ECDiffieHellman
:Configuration
As far as I understand, issue is specific for Windows.
Other information
On Windows
CngKey
for EC key marked withAlgorithmGroup
ECDSA or ECDH. ECDH keys can be used in both algorithms, while ECDSA keys can be used only with ECDSA. As such when key should be usable in both algorithms, then it should be loaded as ECDH. Following code fragment load them as ECDSA:runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs
Lines 1175 to 1186 in 27604b5
Switch cases
Oids.EcPublicKey when IsECDsa(certificate)
andOids.EcPublicKey when IsECDiffieHellman(certificate)
should be reordered to load them as ECDH.The text was updated successfully, but these errors were encountered: