Solution: System.InvalidOperationException: This implementation is not part of the Windows platform FIPS-validated cryptographic algorithm.

Source: Internet
Author: User
Tags md5 encryption

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.