/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.crypto.cipher;

public class JceCipherTest extends AbstractCipherTest {

    @Override
    public void init() {
        transformations = new CipherTransformation[] {
                CipherTransformation.AES_CBC_NOPADDING,
                CipherTransformation.AES_CBC_PKCS5PADDING,
                CipherTransformation.AES_CTR_NOPADDING };
        cipherClass = JceCipher.class.getName();
    }

}

@@ -848,63 +848,257 @@
 r;%0A%0A
-public class JceCipherTest extends AbstractCipherTest %7B
+import java.security.NoSuchAlgorithmException;%0A%0Aimport javax.crypto.Cipher;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.BeforeClass;%0A%0Apublic class JceCipherTest extends AbstractCipherTest %7B%0A%0A    private static final int MAX_KEY_LEN_LOWER_BOUND = 256;
 %0A%0A  
@@ -1418,10 +1418,611 @@
 %0A    %7D%0A%0A
+    @BeforeClass%0A    public void checkJceUnlimitedStrength() throws NoSuchAlgorithmException %7B%0A        int maxKeyLen = Cipher.getMaxAllowedKeyLength(%22AES%22);%0A        Assert.assertTrue(String.format(%0A                %22Testing requires support for an AES key length of %25d, but %22 +%0A                %22the detected maximum key length is %25d.  This may indicate %22 +%0A                %22that the test environment is missing the JCE Unlimited %22 +%0A                %22Strength Jurisdiction Policy Files.%22,%0A                MAX_KEY_LEN_LOWER_BOUND, maxKeyLen),%0A                maxKeyLen %3E= MAX_KEY_LEN_LOWER_BOUND);%0A    %7D%0A
 %7D%0A

Improve assertion message when test fails due to lack of JCE Unlimited Strength Jurisdiction Policy Files. Applied patch and changed @Before to @BeforeClass.