src/share/classes/java/security/Security.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1996, 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1996, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 296,306 ****
*
* @deprecated This method used to return the value of a proprietary
* property in the master file of the "SUN" Cryptographic Service
* Provider in order to determine how to parse algorithm-specific
* parameters. Use the new provider-based and algorithm-independent
! * <code>AlgorithmParameters</code> and <code>KeyFactory</code> engine
* classes (introduced in the J2SE version 1.2 platform) instead.
*/
@Deprecated
public static String getAlgorithmProperty(String algName,
String propName) {
--- 296,306 ----
*
* @deprecated This method used to return the value of a proprietary
* property in the master file of the "SUN" Cryptographic Service
* Provider in order to determine how to parse algorithm-specific
* parameters. Use the new provider-based and algorithm-independent
! * {@code AlgorithmParameters} and {@code KeyFactory} engine
* classes (introduced in the J2SE version 1.2 platform) instead.
*/
@Deprecated
public static String getAlgorithmProperty(String algName,
String propName) {
*** 319,343 ****
* requested algorithms. The position is 1-based, that is,
* 1 is most preferred, followed by 2, and so on.
*
* <p>If the given provider is installed at the requested position,
* the provider that used to be at that position, and all providers
! * with a position greater than <code>position</code>, are shifted up
* one position (towards the end of the list of installed providers).
*
* <p>A provider cannot be added if it is already installed.
*
* <p>First, if there is a security manager, its
! * <code>checkSecurityAccess</code>
* method is called with the string
! * <code>"insertProvider."+provider.getName()</code>
* to see if it's ok to add a new provider.
! * If the default implementation of <code>checkSecurityAccess</code>
* is used (i.e., that method is not overriden), then this will result in
! * a call to the security manager's <code>checkPermission</code> method
* with a
! * <code>SecurityPermission("insertProvider."+provider.getName())</code>
* permission.
*
* @param provider the provider to be added.
*
* @param position the preference position that the caller would
--- 319,343 ----
* requested algorithms. The position is 1-based, that is,
* 1 is most preferred, followed by 2, and so on.
*
* <p>If the given provider is installed at the requested position,
* the provider that used to be at that position, and all providers
! * with a position greater than {@code position}, are shifted up
* one position (towards the end of the list of installed providers).
*
* <p>A provider cannot be added if it is already installed.
*
* <p>First, if there is a security manager, its
! * {@code checkSecurityAccess}
* method is called with the string
! * {@code "insertProvider."+provider.getName()}
* to see if it's ok to add a new provider.
! * If the default implementation of {@code checkSecurityAccess}
* is used (i.e., that method is not overriden), then this will result in
! * a call to the security manager's {@code checkPermission} method
* with a
! * {@code SecurityPermission("insertProvider."+provider.getName())}
* permission.
*
* @param provider the provider to be added.
*
* @param position the preference position that the caller would
*** 347,358 ****
* added, or -1 if the provider was not added because it is
* already installed.
*
* @throws NullPointerException if provider is null
* @throws SecurityException
! * if a security manager exists and its <code>{@link
! * java.lang.SecurityManager#checkSecurityAccess}</code> method
* denies access to add a new provider
*
* @see #getProvider
* @see #removeProvider
* @see java.security.SecurityPermission
--- 347,358 ----
* added, or -1 if the provider was not added because it is
* already installed.
*
* @throws NullPointerException if provider is null
* @throws SecurityException
! * if a security manager exists and its {@link
! * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to add a new provider
*
* @see #getProvider
* @see #removeProvider
* @see java.security.SecurityPermission
*** 372,402 ****
/**
* Adds a provider to the next position available.
*
* <p>First, if there is a security manager, its
! * <code>checkSecurityAccess</code>
* method is called with the string
! * <code>"insertProvider."+provider.getName()</code>
* to see if it's ok to add a new provider.
! * If the default implementation of <code>checkSecurityAccess</code>
* is used (i.e., that method is not overriden), then this will result in
! * a call to the security manager's <code>checkPermission</code> method
* with a
! * <code>SecurityPermission("insertProvider."+provider.getName())</code>
* permission.
*
* @param provider the provider to be added.
*
* @return the preference position in which the provider was
* added, or -1 if the provider was not added because it is
* already installed.
*
* @throws NullPointerException if provider is null
* @throws SecurityException
! * if a security manager exists and its <code>{@link
! * java.lang.SecurityManager#checkSecurityAccess}</code> method
* denies access to add a new provider
*
* @see #getProvider
* @see #removeProvider
* @see java.security.SecurityPermission
--- 372,402 ----
/**
* Adds a provider to the next position available.
*
* <p>First, if there is a security manager, its
! * {@code checkSecurityAccess}
* method is called with the string
! * {@code "insertProvider."+provider.getName()}
* to see if it's ok to add a new provider.
! * If the default implementation of {@code checkSecurityAccess}
* is used (i.e., that method is not overriden), then this will result in
! * a call to the security manager's {@code checkPermission} method
* with a
! * {@code SecurityPermission("insertProvider."+provider.getName())}
* permission.
*
* @param provider the provider to be added.
*
* @return the preference position in which the provider was
* added, or -1 if the provider was not added because it is
* already installed.
*
* @throws NullPointerException if provider is null
* @throws SecurityException
! * if a security manager exists and its {@link
! * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to add a new provider
*
* @see #getProvider
* @see #removeProvider
* @see java.security.SecurityPermission
*** 421,444 ****
*
* <p>This method returns silently if the provider is not installed or
* if name is null.
*
* <p>First, if there is a security manager, its
! * <code>checkSecurityAccess</code>
! * method is called with the string <code>"removeProvider."+name</code>
* to see if it's ok to remove the provider.
! * If the default implementation of <code>checkSecurityAccess</code>
* is used (i.e., that method is not overriden), then this will result in
! * a call to the security manager's <code>checkPermission</code> method
! * with a <code>SecurityPermission("removeProvider."+name)</code>
* permission.
*
* @param name the name of the provider to remove.
*
* @throws SecurityException
! * if a security manager exists and its <code>{@link
! * java.lang.SecurityManager#checkSecurityAccess}</code> method
* denies
* access to remove the provider
*
* @see #getProvider
* @see #addProvider
--- 421,444 ----
*
* <p>This method returns silently if the provider is not installed or
* if name is null.
*
* <p>First, if there is a security manager, its
! * {@code checkSecurityAccess}
! * method is called with the string {@code "removeProvider."+name}
* to see if it's ok to remove the provider.
! * If the default implementation of {@code checkSecurityAccess}
* is used (i.e., that method is not overriden), then this will result in
! * a call to the security manager's {@code checkPermission} method
! * with a {@code SecurityPermission("removeProvider."+name)}
* permission.
*
* @param name the name of the provider to remove.
*
* @throws SecurityException
! * if a security manager exists and its {@link
! * java.lang.SecurityManager#checkSecurityAccess} method
* denies
* access to remove the provider
*
* @see #getProvider
* @see #addProvider
*** 687,697 ****
/*
* Returns an array of objects: the first object in the array is
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
! * The <code>provider</code> argument can be null, in which case all
* configured providers will be searched in order of preference.
*/
static Object[] getImpl(String algorithm, String type, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
if (provider == null) {
--- 687,697 ----
/*
* Returns an array of objects: the first object in the array is
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
! * The {@code provider} argument can be null, in which case all
* configured providers will be searched in order of preference.
*/
static Object[] getImpl(String algorithm, String type, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
if (provider == null) {
*** 718,728 ****
/*
* Returns an array of objects: the first object in the array is
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
! * The <code>provider</code> argument cannot be null.
*/
static Object[] getImpl(String algorithm, String type, Provider provider)
throws NoSuchAlgorithmException {
return GetInstance.getInstance
(type, getSpiClass(type), algorithm, provider).toArray();
--- 718,728 ----
/*
* Returns an array of objects: the first object in the array is
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
! * The {@code provider} argument cannot be null.
*/
static Object[] getImpl(String algorithm, String type, Provider provider)
throws NoSuchAlgorithmException {
return GetInstance.getInstance
(type, getSpiClass(type), algorithm, provider).toArray();
*** 737,758 ****
/**
* Gets a security property value.
*
* <p>First, if there is a security manager, its
! * <code>checkPermission</code> method is called with a
! * <code>java.security.SecurityPermission("getProperty."+key)</code>
* permission to see if it's ok to retrieve the specified
* security property value..
*
* @param key the key of the property being retrieved.
*
* @return the value of the security property corresponding to key.
*
* @throws SecurityException
! * if a security manager exists and its <code>{@link
! * java.lang.SecurityManager#checkPermission}</code> method
* denies
* access to retrieve the specified security property value
* @throws NullPointerException is key is null
*
* @see #setProperty
--- 737,758 ----
/**
* Gets a security property value.
*
* <p>First, if there is a security manager, its
! * {@code checkPermission} method is called with a
! * {@code java.security.SecurityPermission("getProperty."+key)}
* permission to see if it's ok to retrieve the specified
* security property value..
*
* @param key the key of the property being retrieved.
*
* @return the value of the security property corresponding to key.
*
* @throws SecurityException
! * if a security manager exists and its {@link
! * java.lang.SecurityManager#checkPermission} method
* denies
* access to retrieve the specified security property value
* @throws NullPointerException is key is null
*
* @see #setProperty
*** 772,793 ****
/**
* Sets a security property value.
*
* <p>First, if there is a security manager, its
! * <code>checkPermission</code> method is called with a
! * <code>java.security.SecurityPermission("setProperty."+key)</code>
* permission to see if it's ok to set the specified
* security property value.
*
* @param key the name of the property to be set.
*
* @param datum the value of the property to be set.
*
* @throws SecurityException
! * if a security manager exists and its <code>{@link
! * java.lang.SecurityManager#checkPermission}</code> method
* denies access to set the specified security property value
* @throws NullPointerException if key or datum is null
*
* @see #getProperty
* @see java.security.SecurityPermission
--- 772,793 ----
/**
* Sets a security property value.
*
* <p>First, if there is a security manager, its
! * {@code checkPermission} method is called with a
! * {@code java.security.SecurityPermission("setProperty."+key)}
* permission to see if it's ok to set the specified
* security property value.
*
* @param key the name of the property to be set.
*
* @param datum the value of the property to be set.
*
* @throws SecurityException
! * if a security manager exists and its {@link
! * java.lang.SecurityManager#checkPermission} method
* denies access to set the specified security property value
* @throws NullPointerException if key or datum is null
*
* @see #getProperty
* @see java.security.SecurityPermission