Original URL: | https://blogs.msdn.microsoft.com/alejacma/2009/04/30/default-provider-type-for-cspparameters-has-changed/ |
Post name: | Default Provider Type for CspParameters has changed |
Original author: | Alejandro Campos Magencio |
Posting date: | 2009-04-30T10:43:00+00:00 |
Hi all,
Before .NET Framework 3.5 SP1, the default provider type for CspParameterswas PROV_RSA_FULL (1). Now it's PROV_RSA_AES (24) for all operating systems which support Microsoft Enhanced RSA and AES Cryptographic Provider (WinXP and higher).
So if your code depends on PROV_RSA_FULL being set as provider type, you will have to explicitly specify it yourself:
CspParameters cspParams = new CspParameters();
cspParams.ProviderType = 1;
...
RSACryptoServiceProvider RSAalg = new RSACryptoServiceProvider(cspParams);
...
You can check which CSPs you have here in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider
And here which CSP types we have and the default CSP per type:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider Types
You can i.e. check type 24 (RSA Full and AES) here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider Types\Type 024
I hope this helps.
Regards,
Alex (Alejandro Campos Magencio)
Comments: