Part 6 of my attempt to run the [Niko Home Control programming software](https://appdb.winehq.org/objectManager.php?sClass=application&iId=21635) under Wine. PFXImportCertStore's import_key opened a PROV_RSA_FULL / MS_ENHANCED_PROV context. That provider predates SHA-2 and rejects CryptCreateHash(CALG_SHA_256, ...) with NTE_BAD_ALGID. Any code path that later signs with the PFX-imported key using SHA-256 (which is every modern TLS 1.2+ handshake, all TLS 1.3, and every default .NET 8 signature) then fails at signature time. Open MS_ENH_RSA_AES_PROV / PROV_RSA_AES instead. It is a strict superset (same RSA, plus AES, plus SHA-2) and is what current Windows uses for PFX-imported keys. I added a test, without the change, the tests fail with ``` WINEDEBUG=fixme-all,err-all ./loader/wine dlls/crypt32/tests/x86_64-windows/crypt32_test.exe store store.c:1107: Test marked todo: CertOpenStore failed: 00000006 store.c:505: Test marked todo: Cert was not saved in AppData at 3 (3) store.c:2139: Test marked todo: Store registration (dwFlags=00040000) failed, last error 0 store.c:2143: Tests skipped: Nothing to test without registered store at 00040000 store.c:2139: Test marked todo: Store registration (dwFlags=00090000) failed, last error 0 store.c:2143: Tests skipped: Nothing to test without registered store at 00090000 store.c:389: Test marked todo: file store -> system store: expected size 188, got 156 store.c:398: Test marked todo: file store -> system store: unexpected value store.c:2864: Test marked todo: Unexpected cert3 store.c:3637: Test failed: PFX-imported key sits in provider type 1, expected PROV_RSA_AES (24) so that SHA-256 signing works; PROV_RSA_FULL (1) can only hash MD5 and SHA-1 0020:store: 655 tests executed (7 marked as todo, 0 as flaky, 1 failure), 2 skipped. ``` And after the fix, the tests pass ``` $ WINEDEBUG=fixme-all,err-all ./loader/wine dlls/crypt32/tests/x86_64-windows/crypt32_test.exe store store.c:1107: Test marked todo: CertOpenStore failed: 00000006 store.c:505: Test marked todo: Cert was not saved in AppData at 3 (3) store.c:2139: Test marked todo: Store registration (dwFlags=00040000) failed, last error 0 store.c:2143: Tests skipped: Nothing to test without registered store at 00040000 store.c:2139: Test marked todo: Store registration (dwFlags=00090000) failed, last error 0 store.c:2143: Tests skipped: Nothing to test without registered store at 00090000 store.c:389: Test marked todo: file store -> system store: expected size 188, got 156 store.c:398: Test marked todo: file store -> system store: unexpected value store.c:2864: Test marked todo: Unexpected cert3 0020:store: 657 tests executed (7 marked as todo, 0 as flaky, 0 failures), 2 skipped. ``` -- v3: crypt32: Open MS_ENH_RSA_AES_PROV in PFXImportCertStore. https://gitlab.winehq.org/wine/wine/-/merge_requests/11317