From f3ff947746c13faef7874040102e04dcff57a8b7 Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Thu, 25 Jun 2015 17:53:52 +0000 Subject: [PATCH] 8087157: PKCS11 provider not instantiated with security manager 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 | 1 + jdk/test/java/security/Provider/DefaultPKCS11.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/conf/security/java.policy b/jdk/src/java.base/share/conf/security/java.policy index b9485d80e97..aef0017be48 100644 --- a/jdk/src/java.base/share/conf/security/java.policy +++ b/jdk/src/java.base/share/conf/security/java.policy @@ -46,6 +46,7 @@ grant codeBase "jrt:/jdk.crypto.ec" { 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" diff --git a/jdk/test/java/security/Provider/DefaultPKCS11.java b/jdk/test/java/security/Provider/DefaultPKCS11.java index 46b82dd35bd..a7f4c871c53 100644 --- a/jdk/test/java/security/Provider/DefaultPKCS11.java +++ b/jdk/test/java/security/Provider/DefaultPKCS11.java @@ -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 @@ import java.security.*; 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);