System.InvalidOperationException:This implementation is not part of the Windows Platform FIPS validated cryptographic ALG Orithms.
This issue is caused by a system that has FIPS enabled, MD5 encryption in the. NET framework platform, and some other encryption methods that require FIPS validation, but FIPS does not support these methods, which raises the above exception.
Workaround:
Registry Hkey_local_machine\system\currentcontrolset\control\lsa\fipsalgorithmpolicy Project, set the enabled value to 0
You can also include code to check and repair when the program starts, as follows
/// <summary> ///testing MD5 Encryption Availability/// </summary> Public Static voidgeneratingmd5test () {Try{MD5CryptoServiceProvider get_md5=NewMD5CryptoServiceProvider (); } Catch(InvalidOperationException) {closefips (); } Catch(Exception) {}}/// <summary> ///turn off the operating system FIPS feature (this feature turns on causing MD5 encryption in the. NET framework to be incorrect)/// </summary> /// <returns></returns> Private Static BOOLclosefips () {BOOLres =false; Try{RegistryKey LocalMachine=Registry.localmachine; RegistryKey Fipsalgorithmpolicy= Localmachine.createsubkey (@"System\currentcontrolset\control\lsa\fipsalgorithmpolicy"); string[] Vks =Fipsalgorithmpolicy.getvaluenames (); foreach(stringKinchVKS) { if(K.toupper () = ="ENABLED") { if(Fipsalgorithmpolicy.getvalue (k). ToString ()! ="0") {MessageBoxButtons mbs=Messageboxbuttons.okcancel; DialogResult Dre= MessageBox.Show ("An error occurred while the registration system was running, did you attempt to repair (change the registry entry)? ","Tips", MBS); if(Dre = =DialogResult.OK) {fipsalgorithmpolicy.setvalue (k),0); } Break; }}} fipsalgorithmpolicy.close (); Localmachine.close (); Res=true; } Catch(Exception ex) {MessageBox.Show (String.Format ("fix failed with error: {0}{1}{0} See log file for details", Environment.newline,ex. Message),"Error"); Logexception (ex); } returnRes; }
Solution: System.InvalidOperationException: This implementation is not part of the Windows platform FIPS-validated cryptographic algorithm.