View Javadoc

1   /*
2    * Copyright 2004-2006 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.myfaces.shared.util;
17  
18  import junit.framework.Test;
19  
20  /**
21   * This TestCase uses the 3DES algorithm in Electronic CodeBook mode
22   * with PKCS5 padding.
23   * <p/>
24   * <p/>
25   * If you are getting a SecurityException complaining about keysize,
26   * you most likely need to get the unlimited strength jurisdiction
27   * policy files from a place like http://java.sun.com/j2se/1.4.2/download.html .
28   * </p>
29   */
30  
31  public class StateUtilsTripleDES_ECBTest extends AbstractStateUtilsTest
32  {
33  
34      public StateUtilsTripleDES_ECBTest(String name) {
35          super(name);
36      }
37  
38      // No longer necessary using junit 4 to run tests
39      //public static Test suite() {
40      //    return null; // keep this method or maven won't run it
41      //}
42  
43      public void setUp() throws Exception
44      {
45          super.setUp();
46  
47          servletContext.addInitParameter(StateUtils.INIT_SECRET, BASE64_KEY_SIZE_24);
48          servletContext.addInitParameter(StateUtils.INIT_ALGORITHM, "DESede");
49          servletContext.addInitParameter(StateUtils.INIT_ALGORITHM_PARAM, "ECB/PKCS5Padding");
50          servletContext.addInitParameter(StateUtils.INIT_SECRET_KEY_CACHE, "false");
51          servletContext.addInitParameter(StateUtils.INIT_MAC_SECRET, AbstractStateUtilsTest.BASE64_KEY_SIZE_8);
52          StateUtils.initSecret(servletContext); // should do nothing
53  
54      }
55  
56  }