public class TrustManagerFactory
extends Object
| java.lang.Object | |
| ↳ | javax.net.ssl.TrustManagerFactory |
这个班充当基于信任材料来源的信托经理的工厂。 每个信任管理器管理特定类型的信任材料以供安全套接字使用。 信任材料基于KeyStore和/或提供商特定的来源。
也可以看看:
Protected constructors |
|
|---|---|
TrustManagerFactory(TrustManagerFactorySpi factorySpi, Provider provider, String algorithm) 创建一个TrustManagerFactory对象。 |
|
Public methods |
|
|---|---|
final String |
getAlgorithm() 返回此 |
static final String |
getDefaultAlgorithm() 获取默认的TrustManagerFactory算法名称。 |
static final TrustManagerFactory |
getInstance(String algorithm) 返回作为信任管理器的工厂的 |
static final TrustManagerFactory |
getInstance(String algorithm, String provider) 返回充当信任管理器工厂的 |
static final TrustManagerFactory |
getInstance(String algorithm, Provider provider) 返回充当信任管理器工厂的 |
final Provider |
getProvider() 返回此 |
final TrustManager[] |
getTrustManagers() 为每种类型的信任材料返回一个信任管理器。 |
final void |
init(ManagerFactoryParameters spec) 使用特定于提供者的信任材料的来源初始化此工厂。 |
final void |
init(KeyStore ks) 使用证书颁发机构和相关信任材料的来源初始化此工厂。 |
Inherited methods |
|
|---|---|
java.lang.Object
|
|
TrustManagerFactory (TrustManagerFactorySpi factorySpi, Provider provider, String algorithm)
创建一个TrustManagerFactory对象。
| Parameters | |
|---|---|
factorySpi |
TrustManagerFactorySpi: the delegate |
provider |
Provider: the provider |
algorithm |
String: the algorithm |
String getAlgorithm ()
返回此 TrustManagerFactory对象的算法名称。
这与在创建此 TrustManagerFactory对象的 getInstance调用之一中指定的名称相同。
| Returns | |
|---|---|
String |
the algorithm name of this TrustManagerFactory object |
String getDefaultAlgorithm ()
获取默认的TrustManagerFactory算法名称。
通过将“ssl.TrustManagerFactory.algorithm”安全属性(在Java安全属性文件中设置或通过调用 setProperty(String, String) )设置为所需的算法名称,可以在运行时更改默认的TrustManager。
| Returns | |
|---|---|
String |
the default algorithm name as specified in the Java security properties, or an implementation-specific default if no such property exists. |
TrustManagerFactory getInstance (String algorithm)
作为信任管理器的工厂,返回一个 TrustManagerFactory对象。
该方法遍历注册安全提供程序的列表,从最优先的提供程序开始。 将返回一个新的TrustManagerFactory对象,该对象将封装来自支持指定算法的第一个Provider的TrustManagerFactorySpi实现。
请注意,注册供应商列表可能通过 Security.getProviders()方法检索。
| Parameters | |
|---|---|
algorithm |
String: the standard name of the requested trust management algorithm. See the Java Secure Socket Extension Reference Guide for information about standard algorithm names. |
| Returns | |
|---|---|
TrustManagerFactory |
the new TrustManagerFactory object. |
| Throws | |
|---|---|
NoSuchAlgorithmException |
if no Provider supports a TrustManagerFactorySpi implementation for the specified algorithm. |
NullPointerException |
if algorithm is null. |
也可以看看:
TrustManagerFactory getInstance (String algorithm, String provider)
返回作为信任管理器的工厂的对象 TrustManagerFactory 。
返回封装指定提供者的KeyManagerFactorySpi实现的新KeyManagerFactory对象。 指定的提供者必须在安全提供者列表中注册。
请注意,注册供应商列表可能通过 Security.getProviders()方法检索。
| Parameters | |
|---|---|
algorithm |
String: the standard name of the requested trust management algorithm. See the Java Secure Socket Extension Reference Guide for information about standard algorithm names. |
provider |
String: the name of the provider. |
| Returns | |
|---|---|
TrustManagerFactory |
the new TrustManagerFactory object |
| Throws | |
|---|---|
NoSuchAlgorithmException |
if a TrustManagerFactorySpi implementation for the specified algorithm is not available from the specified provider. |
NoSuchProviderException |
if the specified provider is not registered in the security provider list. |
IllegalArgumentException |
if the provider name is null or empty. |
NullPointerException |
if algorithm is null. |
也可以看看:
TrustManagerFactory getInstance (String algorithm, Provider provider)
作为信任管理器的工厂,返回一个 TrustManagerFactory对象。
返回封装指定Provider对象的TrustManagerFactorySpi实现的新TrustManagerFactory对象。 请注意,指定的Provider对象不必在提供程序列表中注册。
| Parameters | |
|---|---|
algorithm |
String: the standard name of the requested trust management algorithm. See the Java Secure Socket Extension Reference Guide for information about standard algorithm names. |
provider |
Provider: an instance of the provider. |
| Returns | |
|---|---|
TrustManagerFactory |
the new TrustManagerFactory object. |
| Throws | |
|---|---|
NoSuchAlgorithmException |
if a TrustManagerFactorySpi implementation for the specified algorithm is not available from the specified Provider object. |
IllegalArgumentException |
if the provider is null. |
NullPointerException |
if algorithm is null. |
也可以看看:
Provider getProvider ()
返回此 TrustManagerFactory对象的提供者。
| Returns | |
|---|---|
Provider |
the provider of this TrustManagerFactory object |
TrustManager[] getTrustManagers ()
为每种类型的信任材料返回一个信任管理器。
| Returns | |
|---|---|
TrustManager[] |
the trust managers |
| Throws | |
|---|---|
IllegalStateException |
if the factory is not initialized. |
void init (ManagerFactoryParameters spec)
使用特定于提供者的信任材料的来源初始化此工厂。
在某些情况下,提供者可能需要初始化参数而非密钥库。 预计该特定供应商的用户将通过提供商定义的相应ManagerFactoryParameters的实施。 然后,提供者可以调用ManagerFactoryParameters实现中的指定方法来获取所需的信息。
| Parameters | |
|---|---|
spec |
ManagerFactoryParameters: an implementation of a provider-specific parameter specification |
| Throws | |
|---|---|
InvalidAlgorithmParameterException |
if an error is encountered |
void init (KeyStore ks)
使用证书颁发机构和相关信任材料的来源初始化此工厂。
提供者通常使用KeyStore作为制定信任决策的基础。
为了更灵活的初始化,请参阅 init(ManagerFactoryParameters) 。
| Parameters | |
|---|---|
ks |
KeyStore: the key store, or null |
| Throws | |
|---|---|
KeyStoreException |
if this operation fails |