.NET Core 3.1 X509 signature
See original GitHub issueI’m having a problem with signing WCF calls with a X509 certificate signature.
The following code works with .NET Framework but it doesn’t with .NET Core because X509SecurityToken
doesn’t exist and I can’t access the RequestSoapContext
.
SvcService.Service ws = new SvcService.Service();
X509Certificate2 cert = new X509Certificate2("cert.pfx",
"privatekeypassword");
X509SecurityToken token = new X509SecurityToken(cert);
ws.RequestSoapContext.Security.Tokens.Add(token);
ws.RequestSoapContext.Security.Elements.Add(new MessageSignature(token));
DataSet ds = ws.GetItem(2081234);
What would be the method to achieve the same in .NET Core? The proxy classes are generated with dotnet-svcutil.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
How to properly validate X.509 certificates in C# with .NET ...
Build() should not be trusted on its own; proper certificate verification requires one manually and separately perform verification of correct ...
Read more >X509SignatureGenerator Class (System.Security. ...
Base class for building encoded signatures as needed for X.509 certificates. ... NET, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1,...
Read more >Using an X509 private key to sign data in dotnet core v2 ...
The dotnet core signed data fails a signature verification check in the .NET 4.5 codebase. Theoretically it should make no difference what the ......
Read more >Certificate Authentication in ASP.NET Core 3.1
In this example, a shared self signed certificate is used to authenticate one application calling an API on a second ASP.NET Core application....
Read more >How to Use Certificates in ASP.NET Core
In this article, we will learn about certificates and why we need them. We will also see how to create a self-signed certificate...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The content type
application/soap+xml
is for SOAP 1.2 andtext/xml
is for SOAP 1.1. So your service is returning a SOAP 1.2 response. You can either modify your binding or create a new binding and setting the appropriate message version on the TextMessageEncodingBindingElement. I suspect the following binding should work for you:If not, then use:
And use the
customBinding
when creating your channel factory.@mconnew is there any plan to enable this signing on .NET Core? I see that you commented that you would like to include it, but issue has since been closed