title: Configuring JSF viewstate encryption in JSF 1.2 with Mojarra
body: <p>I am trying to figure out how to encrypt the viewstate using JSF 1.2 and Mojarra. The odd thing is that it seems to be encrypted by default on some servers, but not on others. For example, on my localhost I see the following:</p>
  
  <pre><code>&lt;input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-40233784603124937:-3413182513789758151" autocomplete="off" /&gt;
  </code></pre>
  
  <p>But on our Test environment servers I get:</p>
  
  <pre><code>&lt;input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id4:j_id5" /&gt;
  </code></pre>
  
  <p>You'll notice two differences between those two:</p>
  
  <ol>
  <li>The first has autocomplete="off"</li>
  <li>The first has the viewState value encrypted, whereas the second does not</li>
  </ol>
  
  <p>The problem is that I cannot figure out for the life of me why the two are different. The codebase is the same on my localhost as on the server. There are no configuration options specified in my web.xml, so I would have assumed that my localhost would not be encrypted (as that is the default, right?).</p>
  
  <p>Per <a href="https://wikis.oracle.com/display/GlassFish/JavaServerFacesRI#JavaServerFacesRI-HowcanIsecureviewstatewhenusingclientsidestatesaving?" rel="nofollow">the Mojarra documentation</a> I should add:</p>
  
  <pre><code>&lt;env-entry&gt;
   &lt;env-entry-name&gt;com.sun.faces.ClientStateSavingPassword&lt;/env-entry-name&gt;
   &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;
   &lt;env-entry-value&gt;[SOME VALUE]&lt;/env-entry-value&gt;
  &lt;/env-entry&gt;
  </code></pre>
  
  <p>But that seems to be specifically for client state saving, not server side state saving. And unless I'm misunderstanding things, I'm using server side state saving (at least, I can't find anywhere that we have configured javax.faces.STATE_SAVING_METHOD.</p>
  
  <p>So, my questions:</p>
  
  <ol>
  <li>Why would my configuration be different between localhost and the server? Is there somewhere else options could be specified other than web.xml?</li>
  <li>How do I enable viewState encryption (like on my localhost) on all our servers?</li>
  </ol>
  
  <p>Configuration:</p>
  
  <ul>
  <li>Jboss 5.1.0.GA</li>
  <li>Mojarra 1.2_12-b01-FCS</li>
  <li>Seam 2.2.0.GA</li>
  </ul>