8087157: PKCS11 provider not instantiated with security manager

Updated java.policy file with sun.misc pkg access permission for SunPKCS11 provider.

Reviewed-by: mullan
This commit is contained in:
Valerie Peng 2015-06-25 17:53:52 +00:00
parent 065a57c31a
commit f3ff947746
2 changed files with 6 additions and 2 deletions

View File

@ -46,6 +46,7 @@ grant codeBase "jrt:/jdk.crypto.ec" {
grant codeBase "jrt:/jdk.crypto.pkcs11" { grant codeBase "jrt:/jdk.crypto.pkcs11" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*"; 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 "accessClassInPackage.sun.nio.ch";
permission java.lang.RuntimePermission "loadLibrary.j2pkcs11"; permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
// needs "security.pkcs11.allowSingleThreadedModules" // needs "security.pkcs11.allowSingleThreadedModules"

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,9 +23,10 @@
/** /**
* @test * @test
* @bug 6260888 * @bug 6260888 8087157
* @summary check SunPKCS11-Solaris is available on S10+ systems * @summary check SunPKCS11-Solaris is available on S10+ systems
* @author Andreas Sterbenz * @author Andreas Sterbenz
* @run main/othervm DefaultPKCS11
*/ */
import java.util.*; import java.util.*;
@ -35,6 +36,8 @@ import java.security.*;
public class DefaultPKCS11 { public class DefaultPKCS11 {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
System.setSecurityManager(new SecurityManager());
String osName = System.getProperty("os.name", "(null)"); String osName = System.getProperty("os.name", "(null)");
String osVersion = System.getProperty("os.version", "(null)"); String osVersion = System.getProperty("os.version", "(null)");
System.out.println("Running on " + osName + " " + osVersion); System.out.println("Running on " + osName + " " + osVersion);