title: How to enforce FIPS in asp.net code (This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.)
body: <p>My company has project created with ASP.NET in .Net Framework 3.5 and a windows web server 2008 r2 to host the project. </p>
  
  <p>In the web server, we enabled the setting for "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing"</p>
  
  <p>After after that the application does not run. it shows the following error</p>
  
  <pre><code>Parser Error Message: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
  </code></pre>
  
  <p>Stack Trace:</p>
  
  <pre><code>[InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.]
     System.Security.Cryptography.RijndaelManaged..ctor() +7715396
     System.Web.Configuration.MachineKeySection.ConfigureEncryptionObject() +232
     System.Web.Configuration.MachineKeySection.EnsureConfig() +156
     System.Web.Configuration.MachineKeySection.GetEncodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32&amp; length) +37
     System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +166
     System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
     System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
     System.Web.UI.HiddenFieldPageStatePersister.Save() +79
     System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +105
     System.Web.UI.Page.SaveAllState() +236
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099
  </code></pre>
  
  <p>We are looking for the solutions for this. Most of the solutions we found online are suggesting to disable FIPS checking by disabling the setting for "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing". 
  Or by adding these two lines in web.config.</p>
  
  <pre><code>&lt;machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="3DES" decryption="3DES"/&gt;
  &lt;enforceFIPSPolicy enabled="false"/&gt;
  </code></pre>
  
  <p>But we don't want to disable FIPS checking for our code for security purpose. 
  Instead we want to adjust our code or server setting so that it will enforce the FIPS policy in the project with interpreting its functionalities. </p>
  
  <p>Can anyone provide me any idea on this? </p>