Skip to content

CipherSuitesPolicy constructor throws PlatformNotSupportedException on Linux with OpenSSL 1.1.1 #61891

@gunnarhelgason

Description

@gunnarhelgason

Description

According to the documentation, it should be possible to use the CipherSuitesPolicy class on Linux systems with OpenSSL 1.1.1 or higher or macOS. However, when using .NET 6 on Linux with OpenSSL 1.1.1, PlatformNotSupportedException is thrown. The same code works fine when using .NET 5

Reproduction Steps

Run the following program:

using System.Net.Security;

namespace csptest
{
    public static class Program
    {
        public static void Main()
        {
            var cipherSuitesPolicy = new CipherSuitesPolicy(new TlsCipherSuite[] { });
        }
    }
}

Expected behavior

Program completes successfully

Actual behavior

Exception is thrown:

Unhandled exception. System.PlatformNotSupportedException: CipherSuitesPolicy is not supported on this platform.
   at System.Net.Security.CipherSuitesPolicyPal..ctor(IEnumerable`1 allowedCipherSuites)
   at System.Net.Security.CipherSuitesPolicy..ctor(IEnumerable`1 allowedCipherSuites)
   at csptest.Program.Main() in /home/gth/csptest/Program.cs:line 9

Regression?

Seems like it, as it works fine on .NET 5

Known Workarounds

No response

Configuration

.NET
.NET 6

dotnet --list-sdks
6.0.100 [/usr/share/dotnet/sdk]
dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

OpenSSL
OpenSSL 1.1.1f

openssl version
OpenSSL 1.1.1f  31 Mar 2020

OS
Ubuntu 20.04.3 LTS x86_64 (completely clean install)

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

Same issue also occurs on Ubuntu 21.10

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions