Various methods for creating a cryptographic API.NET are designed to work with the machine.config file and the System.Security.Cryptography.CryptoConfig type.
This allows the application using them to use the machine implementation of the algorithm (hence the use of machine.config ). For instance.
RSA rsa = RSA.Create ();
will create by default (nothing in the machine.config file), RSACryptoServiceProvider. Now, if you modify the machine.config file, your application may return an instance of RSAManaged (for example, by configuring it to use Mono.Security.dll). This is very useful so that applications can choose specific implementations (for example, certified FIPS-140) or HSM (hardware security modules), that is, there is no need to recompile the application to support them!
Returning to the original Create (string) , this method allows you to choose which implementation to use. It simply calls CryptoConfig.CreateFromName (string) and returns the result, in this case, RSA .
This is useful if you want to be sure to use a specific implementation, for example. RSAManaged - even without binding your application to a specific assembly (eg. Mono.Security.dll).
source share