8087157: PKCS11 provider not instantiated with security manager
authorvaleriep
Thu, 25 Jun 2015 17:53:52 +0000
changeset 31268 63fcde3b5c3b
parent 31267 8fc8b89fe647
child 31269 14968253ce7e
8087157: PKCS11 provider not instantiated with security manager Summary: updated java.policy file with sun.misc pkg access permission for SunPKCS11 provider. Reviewed-by: mullan
jdk/src/java.base/share/conf/security/java.policy
jdk/test/java/security/Provider/DefaultPKCS11.java
--- a/jdk/src/java.base/share/conf/security/java.policy	Thu Jun 25 08:30:34 2015 -0700
+++ b/jdk/src/java.base/share/conf/security/java.policy	Thu Jun 25 17:53:52 2015 +0000
@@ -46,6 +46,7 @@
 
 grant codeBase "jrt:/jdk.crypto.pkcs11" {
         permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
         permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
         permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
         // needs "security.pkcs11.allowSingleThreadedModules"
--- a/jdk/test/java/security/Provider/DefaultPKCS11.java	Thu Jun 25 08:30:34 2015 -0700
+++ b/jdk/test/java/security/Provider/DefaultPKCS11.java	Thu Jun 25 17:53:52 2015 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @bug 6260888
+ * @bug 6260888 8087157
  * @summary check SunPKCS11-Solaris is available on S10+ systems
  * @author Andreas Sterbenz
+ * @run main/othervm DefaultPKCS11
  */
 
 import java.util.*;
@@ -35,6 +36,8 @@
 public class DefaultPKCS11 {
 
     public static void main(String[] args) throws Exception {
+        System.setSecurityManager(new SecurityManager());
+
         String osName = System.getProperty("os.name", "(null)");
         String osVersion = System.getProperty("os.version", "(null)");
         System.out.println("Running on " + osName + " " + osVersion);