dotnet / wcf

This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.
MIT License
1.72k stars 558 forks source link

Alternative to SecurityBindingElement.CreateUserNameForCertificateBindingElement() #5636

Closed dr-matthews closed 2 months ago

dr-matthews commented 3 months ago

Hi, I'm trying to migrate the following code from .NET Framework 4.8 to .NET 6.0/WCF 6.2. It appears that the SecurityBindingElement.CreateUserNameForCertificateBindingElement() method and its return type (SymmetricSecurityBindingElement) are not available in WCF. Is there another way I can achieve the same thing using functinality available in WCF 6.2? If not are there any 3rd party NuGet packages that may support it? Any help would be much appreciated

private static BindingElement CreateSecurityBindingElement()
{
    var bootstrapSecurity = SecurityBindingElement.CreateUserNameForCertificateBindingElement();

    var security = SecurityBindingElement.CreateSecureConversationBindingElement(bootstrapSecurity);
    security.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Default;
    security.IncludeTimestamp = true;
    security.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10;

    return security;
}
HongGit commented 2 months ago

@dr-matthews this is not supported yet. See #5641, which tracks this class of issues.