title: WIF- ID1014: The signature is not valid. The data may have been tampered with
body: <p>I've been using WIF to authenticate our new website, the STS is based upon the starter-sts implementation.</p>
  
  <p>To enable this to work correctly on out load balanced environment I've used the following in the global.asax to override the default certificate behaviour.</p>
  
  <pre><code>void onServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e)
          {
              List&lt;CookieTransform&gt; sessionTransforms = new List&lt;CookieTransform&gt;(new CookieTransform[] 
              { 
                  new DeflateCookieTransform(), 
                  new RsaEncryptionCookieTransform(e.ServiceConfiguration.ServiceCertificate),
                  new RsaSignatureCookieTransform(e.ServiceConfiguration.ServiceCertificate)
              });
  
              SessionSecurityTokenHandler sessionHandler = new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly());
              e.ServiceConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler);
          }
  </code></pre>
  
  <p>This is all working just find and people have been successfully using the system, however every now and then we get a blast of :</p>
  
  <p><strong>ID1014: The signature is not valid. The data may have been tampered with.</strong></p>
  
  <p>in the event logs, so I switched on WIF tracing and saw the following mentioned in the log.</p>
  
  <p><strong>ID1074: A CryptographicException occurred when attempting to encrypt the cookie using the ProtectedData API (see inner exception for details). If you are using IIS 7.5, this could be due to the loadUserProfile setting on the Application Pool being set to false.</strong> </p>
  
  <p>I have a feeling this is leading me down a dark alley as I thought because I'd changed the implementation to use RSA this shouldn't affect me.</p>
  
  <p>Any ideas to help me?</p>