- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,Object>
- Direct Known Subclasses:
AuthProvider
- Algorithms (such as DSA, RSA, or SHA-256).
- Key generation, conversion, and management facilities (such as for algorithm-specific keys).
Some provider implementations may encounter unrecoverable internal errors during their operation, for example a failure to communicate with a security token. A ProviderException
should be used to indicate such errors.
Please note that a provider can be used to implement any security service in Java that uses a pluggable architecture with a choice of implementations that fit underneath.
The service type Provider
is reserved for use by the security framework. Services of this type cannot be added, removed, or modified by applications. The following attributes are automatically placed in each Provider object:
| Name | Value |
|---|---|
Provider.id name
|
String.valueOf(provider.getName())
|
Provider.id version
|
String.valueOf(provider.getVersionStr())
|
Provider.id info
|
String.valueOf(provider.getInfo())
|
Provider.id className
|
provider.getClass().getName()
|
Each provider has a name and a version string. A provider normally identifies itself with a file named java.security.Provider
in the resource directory META-INF/services
. Security providers are looked up via the ServiceLoader
mechanism using the application class loader
.
Providers may be configured such that they are automatically installed and made available at runtime via the Security.getProviders()
method. The mechanism for configuring and installing security providers is implementation-specific.
- Implementation Note:
- The JDK implementation supports static registration of the security providers via the
conf/security/java.securityfile in the Java installation directory. These providers are automatically installed by the JDK runtime, see Moved out of a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase20&id=security_guide_jca_provider.Moved to a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase21&id=security_guide_jca_provider.The Provider ClassMoved out of a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase20&id=security_guide_jca_provider.Moved to a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase21&id=security_guide_jca_provider. in the Java Cryptography Architecture (JCA) Reference Guide for information about how a particular type of provider, the cryptographic service provider, works and is installed. - Since:
- 1.1
- See Also:
Nested Types
- ✓ Service
Constructors
- ✓@Deprecated(since="9")
protected Provider(java.lang.String arg0, double arg1, java.lang.String arg2) - ✓protected Provider(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
Methods
- ✓public void clear()
- ✓public java.lang.Object compute(java.lang.Object arg0, java.util.function.BiFunction<? super java.lang.Object, ? super java.lang.Object, ? extends java.lang.Object> arg1)
- ✓public java.lang.Object computeIfAbsent(java.lang.Object arg0, java.util.function.Function<? super java.lang.Object, ? extends java.lang.Object> arg1)
- ✓public java.lang.Object computeIfPresent(java.lang.Object arg0, java.util.function.BiFunction<? super java.lang.Object, ? super java.lang.Object, ? extends java.lang.Object> arg1)
- ✓public java.security.Provider configure(java.lang.String arg0)
- ✓public java.util.Enumeration<java.lang.Object> elements()
- ✓public java.util.Set<java.util.Map.Entry<java.lang.Object, java.lang.Object>> entrySet()
- ✓public void forEach(java.util.function.BiConsumer<? super java.lang.Object, ? super java.lang.Object> arg0)
- ✓public java.lang.Object get(java.lang.Object arg0)
- ✓public java.lang.String getInfo()
- ✓public java.lang.String getName()
- ✓public java.lang.Object getOrDefault(java.lang.Object arg0, java.lang.Object arg1)
- ✓public java.lang.String getProperty(java.lang.String arg0)
- ✓public java.security.Provider.Service getService(java.lang.String arg0, java.lang.String arg1)
- ✓public java.util.Set<java.security.Provider.Service> getServices()
- ✓@Deprecated(since="9")
public double getVersion() - ✓public java.lang.String getVersionStr()
- ✓public boolean isConfigured()
- ✓public java.util.Set<java.lang.Object> keySet()
- ✓public java.util.Enumeration<java.lang.Object> keys()
- ✓public void load(java.io.InputStream arg0) throws java.io.IOException
- ✓public java.lang.Object merge(java.lang.Object arg0, java.lang.Object arg1, java.util.function.BiFunction<? super java.lang.Object, ? super java.lang.Object, ? extends java.lang.Object> arg2)
- ✓public java.lang.Object put(java.lang.Object arg0, java.lang.Object arg1)
- ✓public void putAll(java.util.Map<?, ?> arg0)
- ✓public java.lang.Object putIfAbsent(java.lang.Object arg0, java.lang.Object arg1)
- ✗protected void putService(java.security.Provider.Service arg0)Comparing jdk-20-ga and jdk-21+35
putService
Add a service. If a service of the same type with the same algorithm name exists, and it was added usingputService(), it is replaced by the new service. This method also places information about this service in the provider's Hashtable values in the format described in the Moved out of a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase20&id=security_guide_jca.Moved to a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase21&id=security_guide_jca.Java Cryptography Architecture (JCA) Reference Guide.Also, if there is a security manager, its
checkSecurityAccessmethod is called with the string"putProviderProperty."+name, wherenameis the provider name, to see if it's ok to set this provider's property values. If the default implementation ofcheckSecurityAccessis used (that is, that method is not overridden), then this results in a call to the security manager'scheckPermissionmethod with aSecurityPermission("putProviderProperty."+name)permission.- Parameters:
s- the Service to add- Throws:
SecurityException- if a security manager exists and itsSecurityManager.checkSecurityAccess(java.lang.String)method denies access to set property values.NullPointerException- if s isnull- Since:
- 1.5
- ✓public java.lang.Object remove(java.lang.Object arg0)
- ✓public boolean remove(java.lang.Object arg0, java.lang.Object arg1)
- ✓protected void removeService(java.security.Provider.Service arg0)
- ✓public java.lang.Object replace(java.lang.Object arg0, java.lang.Object arg1)
- ✓public boolean replace(java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
- ✓public void replaceAll(java.util.function.BiFunction<? super java.lang.Object, ? super java.lang.Object, ? extends java.lang.Object> arg0)
- ✓public java.lang.String toString()
- ✓public java.util.Collection<java.lang.Object> values()
Serialized Form
✓serialVersionUID
✓-4298000515446427739Serialized Fields
- ✓java.lang.String info
- ✓java.lang.String name
- ✓double version
- ✓java.lang.String versionStr
Serialization Methods
- ✓private void readObject(java.io.ObjectInputStream arg0) throws java.io.IOException, java.lang.ClassNotFoundException
Summary
| Elements | Comments | Descriptions | Total | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed | ||
| Provider | 2 | 2 | ||||||||
| putService(Provider.Service) | 1 | 1 | ||||||||
| Total | 3 | 3 | ||||||||