< prev index next >

test/javax/crypto/CryptoPermission/AllPermCheck.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 4953554
  27  * @summary Ensure either IllegalAlgorithmParameterException or
  28  * InvalidKeyException is thrown instead of SecurityException when
  29  * crypto permssion checks failed.
  30  * @author Valerie Peng

  31  */
  32 
  33 import java.io.*;
  34 import java.util.*;
  35 
  36 import java.security.*;
  37 import java.security.spec.*;
  38 
  39 import javax.crypto.*;
  40 import javax.crypto.spec.*;
  41 
  42 public class AllPermCheck {
  43 
  44     private static String SYM_ALGOS[] = {
  45         "AES", "Blowfish", "RC2", "ARCFOUR"
  46     };
  47 
  48     public static void runTest(Cipher c, Key key) throws Exception {
  49         SecureRandom sr = new SecureRandom();
  50 




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 4953554
  27  * @summary Ensure either IllegalAlgorithmParameterException or
  28  * InvalidKeyException is thrown instead of SecurityException when
  29  * crypto permssion checks failed.
  30  * @author Valerie Peng
  31  * @key randomness
  32  */
  33 
  34 import java.io.*;
  35 import java.util.*;
  36 
  37 import java.security.*;
  38 import java.security.spec.*;
  39 
  40 import javax.crypto.*;
  41 import javax.crypto.spec.*;
  42 
  43 public class AllPermCheck {
  44 
  45     private static String SYM_ALGOS[] = {
  46         "AES", "Blowfish", "RC2", "ARCFOUR"
  47     };
  48 
  49     public static void runTest(Cipher c, Key key) throws Exception {
  50         SecureRandom sr = new SecureRandom();
  51 


< prev index next >