When encrypting, can RSACryptoServiceProvider (or any other RSA encryptor available from .NET) use SHA256 instead of SHA1?
SHA1 appears to be hard coded with no way
Just for reference: How to change the CSP within a .p12 or .pfx (certificate with private key). You need the password for the private key within the .pfx in order to do the following steps.
Step 1: Convert the file into open format temp.pem
openssl pkcs12 -in myCert.p12 -out temp.pem -passin pass:myPassword -passout pass:temppwd
or openssl pkcs12 -in myCert.pfx -out temp.pem -passin pass:myPassword -passout pass:temppwd
Step 2: Create file myCert2.pfx containing the CSP reference needed for Windows
openssl pkcs12 -export -in temp.pem -out myCert2.pfx -CSP "Microsoft Enhanced RSA and AES Cryptographic Provider" -passin pass:temppwd -passout pass:myPassword
Step 3: Delete temp.pem. It's no longer needed.
del temp.pem
Step 4: Verify it is done correctly
openssl pkcs12 -info -nodes -in myCert2.pfx -passin pass:myPassword
This must show Microsoft CSP Name: Microsoft Enhanced RSA and AES Cryptographic Provider
With such a modified certificate you can use the 1st code in Kastorskijs answer.