jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java
changeset 35379 1e8e336ef66b
parent 32635 d7e4ba3c2e0d
child 40975 680639c9b307
--- a/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java	Tue Jan 26 09:25:53 2016 +0000
+++ b/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java	Tue Jan 26 13:32:07 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import java.io.File;
 import java.io.IOException;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
@@ -35,6 +36,7 @@
  * @summary Checks that PKCS#11 keystore can't be loaded with wrong password
  * @library ../
  * @run main/othervm LoadKeystore
+ * @run main/othervm LoadKeystore sm policy
  */
 public class LoadKeystore extends SecmodTest {
 
@@ -50,6 +52,12 @@
         System.out.println();
         Security.addProvider(p);
 
+        if (args.length > 1 && "sm".equals(args[0])) {
+            System.setProperty("java.security.policy",
+                    BASE + File.separator + args[1]);
+            System.setSecurityManager(new SecurityManager());
+        }
+
         try {
             System.out.println("Load keystore with wrong type");
             KeyStore.getInstance("unknown", p);