下面列出了java.util.logging.LoggingPermission#java.security.SecurityPermission 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/** Returns a policy containing all the permissions we ever need. */
public static Policy permissivePolicy() {
return new AdjustablePolicy
// Permissions j.u.c. needs directly
(
new RuntimePermission("modifyThread"),
new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader"),
// Permissions needed to change permissions!
new SecurityPermission("getPolicy"),
new SecurityPermission("setPolicy"),
new RuntimePermission("setSecurityManager"),
// Permissions needed by the junit test harness
new RuntimePermission("accessDeclaredMembers"),
new PropertyPermission("*", "read"),
new java.io.FilePermission("<<ALL FILES>>", "read"));
}
public void setBasicPermissions() {
permissions.add(new SecurityPermission("getPolicy"));
permissions.add(new SecurityPermission("setPolicy"));
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new RuntimePermission("setSecurityManager"));
permissions.add(new RuntimePermission("createSecurityManager"));
permissions.add(new PropertyPermission("testng.show.stack.frames",
"read"));
permissions.add(new PropertyPermission("user.dir", "read"));
permissions.add(new PropertyPermission("test.src", "read"));
permissions.add(new PropertyPermission("file.separator", "read"));
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new FilePermission("<<ALL FILES>>", "execute"));
}
/**
* Returns a policy containing all the permissions we ever need.
*/
public static Policy permissivePolicy() {
return new AdjustablePolicy
// Permissions j.u.c. needs directly
(new RuntimePermission("modifyThread"),
new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader"),
// Permissions needed to change permissions!
new SecurityPermission("getPolicy"),
new SecurityPermission("setPolicy"),
new RuntimePermission("setSecurityManager"),
// Permissions needed by the junit test harness
new RuntimePermission("accessDeclaredMembers"),
new PropertyPermission("*", "read"),
new java.io.FilePermission("<<ALL FILES>>", "read"));
}
/**
* Returns a policy containing all the permissions we ever need.
*/
public static Policy permissivePolicy() {
return new AdjustablePolicy
// Permissions j.u.c. needs directly
(new RuntimePermission("modifyThread"),
new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader"),
// new RuntimePermission("modifyThreadGroup"),
// new RuntimePermission("enableContextClassLoaderOverride"),
// Permissions needed to change permissions!
new SecurityPermission("getPolicy"),
new SecurityPermission("setPolicy"),
new RuntimePermission("setSecurityManager"),
// Permissions needed by the junit test harness
new RuntimePermission("accessDeclaredMembers"),
new PropertyPermission("*", "read"),
new java.io.FilePermission("<<ALL FILES>>", "read"));
}
/**
* Returns a policy containing all the permissions we ever need.
*/
public static Policy permissivePolicy() {
return new AdjustablePolicy
// Permissions j.u.c. needs directly
(new RuntimePermission("modifyThread"),
new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader"),
// Permissions needed to change permissions!
new SecurityPermission("getPolicy"),
new SecurityPermission("setPolicy"),
new RuntimePermission("setSecurityManager"),
// Permissions needed by the junit test harness
new RuntimePermission("accessDeclaredMembers"),
new PropertyPermission("*", "read"),
new java.io.FilePermission("<<ALL FILES>>", "read"));
}
/**
* Returns a policy containing all the permissions we ever need.
*/
public static Policy permissivePolicy() {
return new AdjustablePolicy
// Permissions j.u.c. needs directly
(new RuntimePermission("modifyThread"),
new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader"),
// Permissions needed to change permissions!
new SecurityPermission("getPolicy"),
new SecurityPermission("setPolicy"),
new RuntimePermission("setSecurityManager"),
// Permissions needed by the junit test harness
new RuntimePermission("accessDeclaredMembers"),
new PropertyPermission("*", "read"),
new java.io.FilePermission("<<ALL FILES>>", "read"));
}
/**
* Returns a policy containing all the permissions we ever need.
*/
public static Policy permissivePolicy() {
return new AdjustablePolicy
// Permissions j.u.c. needs directly
(new RuntimePermission("modifyThread"),
new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader"),
// Permissions needed to change permissions!
new SecurityPermission("getPolicy"),
new SecurityPermission("setPolicy"),
new RuntimePermission("setSecurityManager"),
// Permissions needed by the junit test harness
new RuntimePermission("accessDeclaredMembers"),
new PropertyPermission("*", "read"),
new java.io.FilePermission("<<ALL FILES>>", "read"));
}
/**
* Loads the keystore.
*
* A compatibility mode is supported for applications that assume
* keystores are stream-based. It permits (but ignores) a non-null
* <code>stream</code> or <code>password</code>.
* The mode is enabled by default.
* Set the
* <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
* system property to <code>false</code> to disable compatibility mode
* and reject a non-null <code>stream</code> or <code>password</code>.
*
* @param stream the input stream, which should be <code>null</code>.
* @param password the password, which should be <code>null</code>.
*
* @exception IOException if there is an I/O or format problem with the
* keystore data. Or if compatibility mode is disabled and either
* parameter is non-null.
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
* @exception SecurityException if the security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
* pass, where <i>name</i> is the value returned by
* this provider's <code>getName</code> method.
*/
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
{
if (stream != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore input stream must be null");
}
if (password != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore password must be null");
}
/*
* Use the same security check as AuthProvider.login
*/
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission(
"authProvider.SunMSCAPI"));
}
// Clear all key entries
entries.clear();
try {
// Load keys and/or certificate chains
loadKeysOrCertificateChains(getName());
} catch (KeyStoreException e) {
throw new IOException(e);
}
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}
private void setMinimalPermissions() {
permissions.add(new SecurityPermission("getPolicy"));
permissions.add(new SecurityPermission("setPolicy"));
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new RuntimePermission("setSecurityManager"));
permissions.add(new RuntimePermission("createSecurityManager"));
permissions.add(new PropertyPermission("testng.show.stack.frames",
"read"));
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
permissions.add(new FilePermission("<<ALL FILES>>",
"read, write, delete"));
}
/**
* Loads the keystore.
*
* A compatibility mode is supported for applications that assume
* keystores are stream-based. It permits (but ignores) a non-null
* <code>stream</code> or <code>password</code>.
* The mode is enabled by default.
* Set the
* <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
* system property to <code>false</code> to disable compatibility mode
* and reject a non-null <code>stream</code> or <code>password</code>.
*
* @param stream the input stream, which should be <code>null</code>.
* @param password the password, which should be <code>null</code>.
*
* @exception IOException if there is an I/O or format problem with the
* keystore data. Or if compatibility mode is disabled and either
* parameter is non-null.
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
* @exception SecurityException if the security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
* pass, where <i>name</i> is the value returned by
* this provider's <code>getName</code> method.
*/
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
{
if (stream != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore input stream must be null");
}
if (password != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore password must be null");
}
/*
* Use the same security check as AuthProvider.login
*/
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission(
"authProvider.SunMSCAPI"));
}
// Clear all key entries
entries.clear();
try {
// Load keys and/or certificate chains
loadKeysOrCertificateChains(getName());
} catch (KeyStoreException e) {
throw new IOException(e);
}
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}
private void setMinimalPermissions() {
permissions.add(new SecurityPermission("getPolicy"));
permissions.add(new SecurityPermission("setPolicy"));
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new RuntimePermission("setSecurityManager"));
permissions.add(new RuntimePermission("createSecurityManager"));
permissions.add(new PropertyPermission("testng.show.stack.frames",
"read"));
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
permissions.add(new FilePermission("<<ALL FILES>>",
"read, write, delete"));
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}
/**
* Loads the keystore.
*
* A compatibility mode is supported for applications that assume
* keystores are stream-based. It permits (but ignores) a non-null
* <code>stream</code> or <code>password</code>.
* The mode is enabled by default.
* Set the
* <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
* system property to <code>false</code> to disable compatibility mode
* and reject a non-null <code>stream</code> or <code>password</code>.
*
* @param stream the input stream, which should be <code>null</code>.
* @param password the password, which should be <code>null</code>.
*
* @exception IOException if there is an I/O or format problem with the
* keystore data. Or if compatibility mode is disabled and either
* parameter is non-null.
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
* @exception SecurityException if the security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
* pass, where <i>name</i> is the value returned by
* this provider's <code>getName</code> method.
*/
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
{
if (stream != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore input stream must be null");
}
if (password != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore password must be null");
}
/*
* Use the same security check as AuthProvider.login
*/
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission(
"authProvider.SunMSCAPI"));
}
// Clear all key entries
entries.clear();
try {
// Load keys and/or certificate chains
loadKeysOrCertificateChains(getName(), entries);
} catch (KeyStoreException e) {
throw new IOException(e);
}
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}
private void setMinimalPermissions() {
permissions.add(new SecurityPermission("getPolicy"));
permissions.add(new SecurityPermission("setPolicy"));
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new RuntimePermission("setSecurityManager"));
permissions.add(new RuntimePermission("createSecurityManager"));
permissions.add(new PropertyPermission("testng.show.stack.frames",
"read"));
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
permissions.add(new FilePermission("<<ALL FILES>>",
"read, write, delete"));
}
/**
* Loads the keystore.
*
* A compatibility mode is supported for applications that assume
* keystores are stream-based. It permits (but ignores) a non-null
* <code>stream</code> or <code>password</code>.
* The mode is enabled by default.
* Set the
* <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
* system property to <code>false</code> to disable compatibility mode
* and reject a non-null <code>stream</code> or <code>password</code>.
*
* @param stream the input stream, which should be <code>null</code>.
* @param password the password, which should be <code>null</code>.
*
* @exception IOException if there is an I/O or format problem with the
* keystore data. Or if compatibility mode is disabled and either
* parameter is non-null.
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
* @exception SecurityException if the security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
* pass, where <i>name</i> is the value returned by
* this provider's <code>getName</code> method.
*/
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException {
if (stream != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore input stream must be null");
}
if (password != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore password must be null");
}
/*
* Use the same security check as AuthProvider.login
*/
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission(
"authProvider.SunMSCAPI"));
}
// Clear all key entries
entries.clear();
try {
// Load keys and/or certificate chains
loadKeysOrCertificateChains(getName());
} catch (KeyStoreException e) {
throw new IOException(e);
}
if (debug != null) {
debug.println("MSCAPI keystore load: entry count: " +
entries.size());
}
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}
private void setMinimalPermissions() {
permissions.add(new SecurityPermission("getPolicy"));
permissions.add(new SecurityPermission("setPolicy"));
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new RuntimePermission("setSecurityManager"));
permissions.add(new RuntimePermission("createSecurityManager"));
permissions.add(new PropertyPermission("testng.show.stack.frames",
"read"));
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
permissions.add(new FilePermission("<<ALL FILES>>",
"read, write, delete"));
}
/**
* Loads the keystore.
*
* A compatibility mode is supported for applications that assume
* keystores are stream-based. It permits (but ignores) a non-null
* <code>stream</code> or <code>password</code>.
* The mode is enabled by default.
* Set the
* <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
* system property to <code>false</code> to disable compatibility mode
* and reject a non-null <code>stream</code> or <code>password</code>.
*
* @param stream the input stream, which should be <code>null</code>.
* @param password the password, which should be <code>null</code>.
*
* @exception IOException if there is an I/O or format problem with the
* keystore data. Or if compatibility mode is disabled and either
* parameter is non-null.
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
* @exception SecurityException if the security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
* pass, where <i>name</i> is the value returned by
* this provider's <code>getName</code> method.
*/
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
{
if (stream != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore input stream must be null");
}
if (password != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore password must be null");
}
/*
* Use the same security check as AuthProvider.login
*/
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission(
"authProvider.SunMSCAPI"));
}
// Clear all key entries
entries.clear();
try {
// Load keys and/or certificate chains
loadKeysOrCertificateChains(getName());
} catch (KeyStoreException e) {
throw new IOException(e);
}
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}
private void setMinimalPermissions() {
permissions.add(new SecurityPermission("getPolicy"));
permissions.add(new SecurityPermission("setPolicy"));
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new RuntimePermission("setSecurityManager"));
permissions.add(new RuntimePermission("createSecurityManager"));
permissions.add(new PropertyPermission("testng.show.stack.frames",
"read"));
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
permissions.add(new FilePermission("<<ALL FILES>>",
"read, write, delete"));
}
/**
* Loads the keystore.
*
* A compatibility mode is supported for applications that assume
* keystores are stream-based. It permits (but ignores) a non-null
* <code>stream</code> or <code>password</code>.
* The mode is enabled by default.
* Set the
* <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
* system property to <code>false</code> to disable compatibility mode
* and reject a non-null <code>stream</code> or <code>password</code>.
*
* @param stream the input stream, which should be <code>null</code>.
* @param password the password, which should be <code>null</code>.
*
* @exception IOException if there is an I/O or format problem with the
* keystore data. Or if compatibility mode is disabled and either
* parameter is non-null.
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
* @exception SecurityException if the security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
* pass, where <i>name</i> is the value returned by
* this provider's <code>getName</code> method.
*/
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
{
if (stream != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore input stream must be null");
}
if (password != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore password must be null");
}
/*
* Use the same security check as AuthProvider.login
*/
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission(
"authProvider.SunMSCAPI"));
}
// Clear all key entries
entries.clear();
try {
// Load keys and/or certificate chains
loadKeysOrCertificateChains(getName());
} catch (KeyStoreException e) {
throw new IOException(e);
}
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}
private void setMinimalPermissions() {
permissions.add(new SecurityPermission("getPolicy"));
permissions.add(new SecurityPermission("setPolicy"));
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new RuntimePermission("setSecurityManager"));
permissions.add(new RuntimePermission("createSecurityManager"));
permissions.add(new PropertyPermission("testng.show.stack.frames",
"read"));
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
permissions.add(new FilePermission("<<ALL FILES>>",
"read, write, delete"));
}
private void setDefaultPermissions() {
//Permissions to set security manager and policy
addPermission(new SecurityPermission("getPolicy"));
addPermission(new SecurityPermission("setPolicy"));
addPermission(new RuntimePermission("setSecurityManager"));
addPermission(new PropertyPermission("test.src", "read"));
}
/**
* {@inheritDoc}
*
* @see java.lang.SecurityManager#checkPermission(java.security.Permission)
*/
@Override
public void checkPermission ( Permission perm ) {
if ( perm instanceof RuntimePermission ) {
if ( checkRuntimePermission((RuntimePermission) perm) ) {
return;
}
}
else if ( perm instanceof ReflectPermission ) {
return;
}
else if ( perm instanceof LoggingPermission ) {
return;
}
else if ( perm instanceof SecurityPermission ) {
return;
}
else if ( perm instanceof PropertyPermission ) {
return;
}
else if ( perm instanceof NetPermission && perm.getName().equals("specifyStreamHandler") ) {
return;
}
else if ( perm instanceof FilePermission && perm.getActions().equals("read") ) {
return;
}
else if ( perm instanceof SerializablePermission ) {
return;
}
super.checkPermission(perm);
}
/**
* Loads the keystore.
*
* A compatibility mode is supported for applications that assume
* keystores are stream-based. It permits (but ignores) a non-null
* <code>stream</code> or <code>password</code>.
* The mode is enabled by default.
* Set the
* <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
* system property to <code>false</code> to disable compatibility mode
* and reject a non-null <code>stream</code> or <code>password</code>.
*
* @param stream the input stream, which should be <code>null</code>.
* @param password the password, which should be <code>null</code>.
*
* @exception IOException if there is an I/O or format problem with the
* keystore data. Or if compatibility mode is disabled and either
* parameter is non-null.
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
* @exception SecurityException if the security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
* pass, where <i>name</i> is the value returned by
* this provider's <code>getName</code> method.
*/
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
{
if (stream != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore input stream must be null");
}
if (password != null && !keyStoreCompatibilityMode) {
throw new IOException("Keystore password must be null");
}
/*
* Use the same security check as AuthProvider.login
*/
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission(
"authProvider.SunMSCAPI"));
}
// Clear all key entries
entries.clear();
try {
// Load keys and/or certificate chains
loadKeysOrCertificateChains(getName());
} catch (KeyStoreException e) {
throw new IOException(e);
}
}
NewInstancePolicy(boolean grant) {
this.grant = grant;
permissions.add(new SecurityPermission("getPolicy"));
if (grant) {
permissions.add(new RuntimePermission("getClassLoader"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
}
}