This class centralizes all security properties and common security methods. One of its primary uses is to manage providers.
The default values of security properties are read from an
implementation-specific location, which is typically the properties file
conf/security/java.security in the Java installation directory.
Implementation Note
If the properties file fails to load, the JDK implementation will
throw an unspecified error when initializing the Security class.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static Properties | |
| private static final Properties | |
| private static final Debug | |
| private static final Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns: the preference position in which the provider was added, or -1 if the provider was not added because it is already installed.the provider to be added. provider)Adds a provider to the next position available. |
| public static String | Returns: the value of the specified property.the algorithm name. algName, String the name of the property to get. propName)
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.
Gets a specified property for an algorithm. |
| public static Set | Returns: a Set ofString objects containing the names of all
available algorithms or types for the specified Java cryptographic
service or an empty set if no provider supports the specified service.the name of the Java cryptographic
service (e.g., serviceName)Signature, MessageDigest, Cipher,
Mac, KeyStore).
Note this parameter is case-insensitive. Returns a Set of |
| pack-priv static Object[] | |
| pack-priv static Object[] | |
| pack-priv static Object[] | |
| pack-priv static Object[] | |
| public static String | Returns: the value of the security property, ornull if there
is no property with that key.the key of the property being retrieved. key)Gets a security property value. |
| public static Provider | Returns: the provider of the specified name.the name of the provider to get. name)Returns the provider installed with the specified name, if any. |
| private static Security. | getProviderProperty(String key)
Looks up providers, and returns the property (and its associated provider) mapping the key, if any. |
| private static String | getProviderProperty(String key, Provider provider)
Returns the property (if any) mapping the key for the given provider. |
| public static Provider[] | Returns: an array of all the installed providers.Returns an array containing all the installed providers. |
| public static Provider[] | Returns: all the installed providers that satisfy the selection criterion, ornull if no such providers have been installed.the criterion for selecting
providers. The filter is case-insensitive. filter)Returns an array containing all installed providers that satisfy the
specified selection criterion, or |
| public static Provider[] | Returns: all the installed providers that satisfy the selection criteria, ornull if no such providers have been installed.the criteria for selecting
providers. The filter is case-insensitive. filter)Returns an array containing all installed providers that satisfy the
specified selection criteria, or |
| private static Class | |
| private static void | |
| public static synchronized int | Returns: the actual preference position in which the provider was added, or -1 if the provider was not added because it is already installed.the provider to be added. provider, int the preference position that the caller would
like for this provider. position)Adds a new provider, at a specified position. |
| private static URL | |
| public static synchronized void | removeProvider(String
the name of the provider to remove. name)Removes the provider with the specified name. |
| public static void | setProperty(String
the name of the property to be set. key, String the value of the property to be set. datum)Sets a security property value. |
| initialSecurityProperties | back to summary |
|---|---|
| private static Properties initialSecurityProperties | |
| props | back to summary |
|---|---|
| private static final Properties props | |
| sdebug | back to summary |
|---|---|
| private static final Debug sdebug | |
| spiMap | back to summary |
|---|---|
| private static final Map<String, Class<?>> spiMap | |
| Security | back to summary |
|---|---|
| private Security() Don't let anyone instantiate this. | |
| addProvider | back to summary |
|---|---|
| public static int addProvider(Provider provider) Adds a provider to the next position available.
| |
| getAlgorithmProperty | back to summary |
|---|---|
| public static String getAlgorithmProperty(String algName, String propName)
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
Gets a specified property for an algorithm. The algorithm name should be a standard name. See the Java Security Standard Algorithm Names Specification for information about standard algorithm names. One possible use is by specialized algorithm parsers, which may map classes to algorithms which they understand (much like Key parsers do).
| |
| getAlgorithms | back to summary |
|---|---|
| public static Set Returns a Set of Note the returned set is immutable.
| |
| getImpl | back to summary |
|---|---|
| pack-priv static Object[] getImpl(String algorithm, String type, String provider) throws NoSuchAlgorithmException, NoSuchProviderException | |
| getImpl | back to summary |
|---|---|
| pack-priv static Object[] getImpl(String algorithm, String type, String provider, Object params) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException | |
| getImpl | back to summary |
|---|---|
| pack-priv static Object[] getImpl(String algorithm, String type, Provider provider) throws NoSuchAlgorithmException | |
| getImpl | back to summary |
|---|---|
| pack-priv static Object[] getImpl(String algorithm, String type, Provider provider, Object params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException | |
| getProperty | back to summary |
|---|---|
| public static String getProperty(String key) Gets a security property value.
| |
| getProvider | back to summary |
|---|---|
| public static Provider getProvider(String name) Returns the provider installed with the specified name, if
any. Returns
| |
| getProviderProperty | back to summary |
|---|---|
| private static Security. Looks up providers, and returns the property (and its associated provider) mapping the key, if any. The order in which the providers are looked up is the provider-preference order, as specified in the security properties file. | |
| getProviderProperty | back to summary |
|---|---|
| private static String getProviderProperty(String key, Provider provider) Returns the property (if any) mapping the key for the given provider. | |
| getProviders | back to summary |
|---|---|
| public static Provider[] getProviders() Returns an array containing all the installed providers. The order of the providers in the array is their preference order.
| |
| getProviders | back to summary |
|---|---|
| public static Provider[] getProviders(String filter) Returns an array containing all installed providers that satisfy the
specified selection criterion, or A cryptographic service is always associated with a particular algorithm or type. For example, a digital signature service is always associated with a particular algorithm (e.g., DSA), and a CertificateFactory service is always associated with a particular certificate type (e.g., X.509). The selection criterion must be specified in one of the following two formats:
See the Java Security Standard Algorithm Names Specification for information about standard cryptographic service names, standard algorithm names and standard attribute names.
| |
| getProviders | back to summary |
|---|---|
| public static Provider[] getProviders(Map<String, String> filter) Returns an array containing all installed providers that satisfy the
specified selection criteria, or The selection criteria are represented by a map. Each map entry represents a selection criterion. A provider is selected iff it satisfies all selection criteria. The key for any entry in such a map must be in one of the following two formats:
See the Java Security Standard Algorithm Names Specification for information about standard cryptographic service names, standard algorithm names and standard attribute names.
| |
| getSpiClass | back to summary |
|---|---|
| private static Class Return the Class object for the given engine type (e.g. "MessageDigest"). Works for Spis in the java.security package only. | |
| initialize | back to summary |
|---|---|
| private static void initialize() | |
| insertProviderAt | back to summary |
|---|---|
| public static synchronized int insertProviderAt(Provider provider, int position) Adds a new provider, at a specified position. The position is the preference order in which providers are searched for requested algorithms. The position is 1-based, that is, 1 is most preferred, followed by 2, and so on. If the position is less than 1 or greater than n, where n is the number of installed providers, the provider (if not already installed) is inserted at the end of the list, or at the n + 1 position. 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 A provider cannot be added if it is already installed.
| |
| newURL | back to summary |
|---|---|
private static URL newURL(String spec) throws MalformedURLException
| |
| removeProvider | back to summary |
|---|---|
| public static synchronized void removeProvider(String name) Removes the provider with the specified name. When the specified provider is removed, all providers located at a position greater than where the specified provider was are shifted down one position (towards the head of the list of installed providers). This method returns silently if the provider is not installed or
if name is
| |
| setProperty | back to summary |
|---|---|
| public static void setProperty(String key, String datum) Sets a security property value.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final String | |
| private final String | |
| private final String |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| private boolean |
| algName | back to summary |
|---|---|
| private final String algName | |
| attrName | back to summary |
|---|---|
| private final String attrName | |
| attrValue | back to summary |
|---|---|
| private final String attrValue | |
| serviceName | back to summary |
|---|---|
| private final String serviceName | |
| Criteria | back to summary |
|---|---|
| pack-priv Criteria(String key, String value) throws InvalidParameterException | |
| isCompositeValue | back to summary |
|---|---|
| private boolean isCompositeValue() | |
| isCriterionSatisfied | back to summary |
|---|---|
| private boolean isCriterionSatisfied(Provider prov) | |
| Access | Constructor and Description |
|---|---|
| private |
| className | back to summary |
|---|---|
| pack-priv String className | |
| provider | back to summary |
|---|---|
| pack-priv Provider provider | |
| ProviderProperty | back to summary |
|---|---|
| private ProviderProperty() | |
| Modifier and Type | Class and Description |
|---|---|
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private static final List | |
| private static Path | |
| private static final String | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| pack-priv static void | |
| private static void | |
| pack-priv static boolean | |
| pack-priv static void | |
| private static void | |
| private static Exception | |
| private static Exception | |
| private static void | |
| private static void | |
| private static void | |
| pack-priv static void | |
| private static void | |
| private static void |
| activePaths | back to summary |
|---|---|
| private static final List<Path> activePaths | |
| currentPath | back to summary |
|---|---|
| private static Path currentPath | |
| EXTRA_SYS_PROP | back to summary |
|---|---|
| private static final String EXTRA_SYS_PROP | |
| OVERRIDE_SEC_PROP | back to summary |
|---|---|
| private static final String OVERRIDE_SEC_PROP | |
| SecPropLoader | back to summary |
|---|---|
| private SecPropLoader() | |
| checkCyclicInclude | back to summary |
|---|---|
| private static void checkCyclicInclude(Path path) | |
| checkReservedKey | back to summary |
|---|---|
| pack-priv static void checkReservedKey(String key) throws IllegalArgumentException | |
| debugLoad | back to summary |
|---|---|
| private static void debugLoad(boolean start, Object source) | |
| isInclude | back to summary |
|---|---|
| pack-priv static boolean isInclude(String key) | |
| loadAll | back to summary |
|---|---|
| pack-priv static void loadAll() | |
| loadExtra | back to summary |
|---|---|
| private static void loadExtra() | |
| loadExtraFromFileUrl | back to summary |
|---|---|
| private static Exception loadExtraFromFileUrl(URI uri, Security. | |
| loadExtraFromPath | back to summary |
|---|---|
| private static Exception loadExtraFromPath(String propFile, Security. | |
| loadExtraHelper | back to summary |
|---|---|
| private static void loadExtraHelper(String propFile, Security. | |
| loadFromPath | back to summary |
|---|---|
| private static void loadFromPath(Path path, Security. | |
| loadFromUrl | back to summary |
|---|---|
| private static void loadFromUrl(URL url, Security. | |
| loadInclude | back to summary |
|---|---|
| pack-priv static void loadInclude(String propFile) | |
| loadMaster | back to summary |
|---|---|
| private static void loadMaster() | |
| reset | back to summary |
|---|---|
| private static void reset(Security. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Security. | |
| public static final Security. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Security. | |
| public static Security. |
| APPEND | back to summary |
|---|---|
| public static final Security. | |
| OVERRIDE | back to summary |
|---|---|
| public static final Security. | |
| LoadingMode | back to summary |
|---|---|
| private LoadingMode() | |
| valueOf | back to summary |
|---|---|
| public static Security. | |
| values | back to summary |
|---|---|
| public static Security. | |