https://bugs.winehq.org/show_bug.cgi?id=49144
Bug ID: 49144 Summary: Opening a PFX certificate in a dotnet application using X509Certificate2 Product: Wine Version: 5.8 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: petrov_lv@ekra.ru Distribution: ---
Created attachment 67146 --> https://bugs.winehq.org/attachment.cgi?id=67146 output for wine
There is a crash in the test application when opening the PFX certificate. The certificate contains a private key.
Test application: using System; using System.Security.Cryptography.X509Certificates;
namespace CheckPfx { class Program { static void Main(string[] args) { if (args.Length == 2) { var fileName = args[0]; var password = args[1]; var cert2 = new X509Certificate2(fileName, password); Console.WriteLine($"HasPrivateKey: {cert2.HasPrivateKey}"); } else { Console.WriteLine("using: <appName.exe> <pfx-file> <password>"); } } } }
Сertificate creation: certtool --dsa --generate-privkey --outfile key.pem certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template template.cfg certtool --load-certificate cert.pem --load-privkey key.pem --to-p12 --outder --outfile cert.pfx
Output for windows: HasPrivateKey: True
Output for wine: (in attached file) Unhandled Exception: System.Security.Cryptography.CryptographicException: Invalid parameter.