public class PKIXParameters
extends Object implements CertPathParameters
| java.lang.Object | |
| java.security.cert.PKIXParameters | |
| |
用作PKIX CertPathValidator算法输入的参数。
PKIX CertPathValidator使用这些参数根据PKIX证书路径验证算法验证 CertPath 。
要实例化一个PKIXParameters对象,应用程序必须指定一个或多个由PKIX证书路径验证算法定义的最受信任的CA. 最信任的CA可以使用两个构造函数之一来指定。 应用程序可以调用PKIXParameters(Set) ,指定Set个TrustAnchor对象,其中每个对象都标识最受信任的CA. 或者,应用程序可以调用PKIXParameters(KeyStore) ,指定包含可信证书条目的KeyStore实例,每个实例将被视为最受信任的CA.
一旦创建了一个 PKIXParameters对象,就可以指定其他参数(例如,通过调用 setInitialPolicies或 setDate ),然后将 PKIXParameters与 CertPath一起传递以验证为 CertPathValidator.validate 。
任何未设置的参数(或设置为null )都将设置为该参数的默认值。 date参数的默认值为null ,表示路径验证的当前时间。 其余参数的默认值是最不受限制的。
并发访问
除非另有说明,否则此类中定义的方法不是线程安全的。 需要同时访问单个对象的多个线程应该自己同步并提供必要的锁定。 每个操作单独对象的多个线程不需要同步。
也可以看看:
Public constructors |
|
|---|---|
PKIXParameters(Set<TrustAnchor> trustAnchors) 使用最受信任的CA的指定 |
|
PKIXParameters(KeyStore keystore) 创建一个 |
|
公共方法(Public methods) |
|
|---|---|
void |
addCertPathChecker(PKIXCertPathChecker checker) 将 |
void |
addCertStore(CertStore store) 将 |
Object |
clone() 制作此 |
List<PKIXCertPathChecker> |
getCertPathCheckers() 返回证书路径检查器的 |
List<CertStore> |
getCertStores() 返回用于查找证书和CRL的不可变 |
Date |
getDate() 返回应确定认证路径有效性的时间。 |
Set<String> |
getInitialPolicies() 返回初始策略标识符(OID字符串)的不可变 |
boolean |
getPolicyQualifiersRejected() 获取PolicyQualifiersRejected标志。 |
String |
getSigProvider() 返回签名提供者的名称,如果未设置,则返回 |
CertSelector |
getTargetCertConstraints() 返回目标证书上的必需约束。 |
Set<TrustAnchor> |
getTrustAnchors() 返回最可信CA的不可变 |
boolean |
isAnyPolicyInhibited() 检查是否应将任何策略OID包含在证书中进行处理。 |
boolean |
isExplicitPolicyRequired() 检查是否需要显式策略。 |
boolean |
isPolicyMappingInhibited() 检查策略映射是否被禁止。 |
boolean |
isRevocationEnabled() 检查RevocationEnabled标志。 |
void |
setAnyPolicyInhibited(boolean val) 设置状态以确定是否应该处理任何策略OID,如果它包含在证书中。 |
void |
setCertPathCheckers(List<PKIXCertPathChecker> checkers) 设置一个 |
void |
setCertStores(List<CertStore> stores) 设置用于查找证书和CRL的列表 |
void |
setDate(Date date) 设置确定证书路径有效性的时间。 |
void |
setExplicitPolicyRequired(boolean val) 设置ExplicitPolicyRequired标志。 |
void |
setInitialPolicies(Set<String> initialPolicies) 设置初始策略标识符(OID字符串)的 |
void |
setPolicyMappingInhibited(boolean val) 设置PolicyMappingInhibited标志。 |
void |
setPolicyQualifiersRejected(boolean qualifiersRejected) 设置PolicyQualifiersRejected标志。 |
void |
setRevocationEnabled(boolean val) 设置RevocationEnabled标志。 |
void |
setSigProvider(String sigProvider) 设置签名提供者的名称。 |
void |
setTargetCertConstraints(CertSelector selector) 设置目标证书上的必需约束。 |
void |
setTrustAnchors(Set<TrustAnchor> trustAnchors) 设置最受信任的CA的 |
String |
toString() 返回描述参数的格式化字符串。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
java.security.cert.CertPathParameters
|
|
PKIXParameters (Set<TrustAnchor> trustAnchors)
用指定的Set最受信任的CA创建PKIXParameters的实例。 该集合中的每个元素都是TrustAnchor 。
请注意,复制了 Set以防止后续修改。
| 参数(Parameters) | |
|---|---|
trustAnchors |
Set: a Set of TrustAnchors |
| 抛出异常(Throws) | |
|---|---|
InvalidAlgorithmParameterException |
if the specified Set is empty (trustAnchors.isEmpty() == true) |
NullPointerException |
if the specified Set is null |
ClassCastException |
if any of the elements in the Set are not of type java.security.cert.TrustAnchor |
PKIXParameters (KeyStore keystore)
创建一个PKIXParameters的实例,该实例从指定的KeyStore包含的受信任证书条目填充最受信任的CA KeyStore 。 只考虑包含可信X509Certificates密钥库条目; 所有其他证书类型都将被忽略。
| 参数(Parameters) | |
|---|---|
keystore |
KeyStore: a KeyStore from which the set of most-trusted CAs will be populated |
| 抛出异常(Throws) | |
|---|---|
KeyStoreException |
if the keystore has not been initialized |
InvalidAlgorithmParameterException |
if the keystore does not contain at least one trusted certificate entry |
NullPointerException |
if the keystore is null |
void addCertPathChecker (PKIXCertPathChecker checker)
将PKIXCertPathChecker添加到认证路径检查程序的列表中。 有关更多详细信息,请参阅setCertPathCheckers方法。
请注意, PKIXCertPathChecker被克隆以防止后续修改。
| 参数(Parameters) | |
|---|---|
checker |
PKIXCertPathChecker: a PKIXCertPathChecker to add to the list of checks. If null, the checker is ignored (not added to list). |
void addCertStore (CertStore store)
将 CertStore添加到用于查找证书和CRL的 CertStore列表的 CertStore 。
| 参数(Parameters) | |
|---|---|
store |
CertStore: the CertStore to add. If null, the store is ignored (not added to list). |
Object clone ()
制作此PKIXParameters对象的副本。 副本的更改不会影响原件,反之亦然。
| 返回(Returns) | |
|---|---|
Object |
a copy of this PKIXParameters object |
List<PKIXCertPathChecker> getCertPathCheckers ()
返回认证路径检查器的List 。 返回的List是不可变的,并且PKIXCertPathChecker中的每个PKIXCertPathChecker List被克隆以防止后续修改。
| 返回(Returns) | |
|---|---|
List<PKIXCertPathChecker> |
an immutable List of PKIXCertPathCheckers (may be empty, but not null) |
也可以看看:
List<CertStore> getCertStores ()
返回用于查找证书和CRL的不可变 List的 CertStore 。
| 返回(Returns) | |
|---|---|
List<CertStore> |
an immutable List of CertStores (may be empty, but never null) |
也可以看看:
Date getDate ()
返回应确定认证路径有效性的时间。 如果null ,则使用当前时间。
请注意,返回的 Date已被复制以防止后续修改。
| 返回(Returns) | |
|---|---|
Date |
the Date, or null if not set |
也可以看看:
Set<String> getInitialPolicies ()
返回初始策略标识符(OID字符串)的不可变Set ,表明证书用户可以接受任何一种策略用于证书路径处理。 默认返回值是空的Set ,这意味着任何策略都可以接受。
| 返回(Returns) | |
|---|---|
Set<String> |
an immutable Set of initial policy OIDs in String format, or an empty Set (implying any policy is acceptable). Never returns null. |
也可以看看:
boolean getPolicyQualifiersRejected ()
获取PolicyQualifiersRejected标志。 如果此标志为true,则在标记为关键的证书策略扩展中包含策略限定符的证书将被拒绝。 如果该标志为假,证书不会在此基础上被拒绝。
当一个PKIXParameters对象被创建时,这个标志被设置为true。 此设置反映了处理策略限定符的最常见(也是最简单的)策略。 想要使用更复杂策略的应用程序必须将此标志设置为false。
| 返回(Returns) | |
|---|---|
boolean |
the current value of the PolicyQualifiersRejected flag |
String getSigProvider ()
返回签名提供者的名称,如果未设置,则返回 null 。
| 返回(Returns) | |
|---|---|
String |
the signature provider's name (or null) |
也可以看看:
CertSelector getTargetCertConstraints ()
返回目标证书上的必需约束。 限制条件以CertSelector的实例形式CertSelector 。 如果null ,则不定义约束。
请注意,返回的 CertSelector已克隆,以防止后续修改。
| 返回(Returns) | |
|---|---|
CertSelector |
a CertSelector specifying the constraints on the target certificate (or null) |
Set<TrustAnchor> getTrustAnchors ()
返回最可信CA的不可变 Set 。
| 返回(Returns) | |
|---|---|
Set<TrustAnchor> |
an immutable Set of TrustAnchors (never null) |
也可以看看:
boolean isAnyPolicyInhibited ()
检查是否应将任何策略OID包含在证书中进行处理。
| 返回(Returns) | |
|---|---|
boolean |
true if the any policy OID is inhibited, false otherwise |
boolean isExplicitPolicyRequired ()
检查是否需要显式策略。 如果此标志为真,则需要在每个证书中明确标识可接受的策略。 默认情况下,ExplicitPolicyRequired标志为false。
| 返回(Returns) | |
|---|---|
boolean |
true if explicit policy is required, false otherwise |
boolean isPolicyMappingInhibited ()
检查策略映射是否被禁止。 如果此标志为真,则禁止策略映射。 默认情况下,策略映射不会被禁止(该标志为false)。
| 返回(Returns) | |
|---|---|
boolean |
true if policy mapping is inhibited, false otherwise |
boolean isRevocationEnabled ()
检查RevocationEnabled标志。 如果此标志为true,则将使用基础PKIX服务提供程序的默认吊销检查机制。 如果此标志为false,则默认的撤销检查机制将被禁用(未使用)。 有关设置此标志值的更多详细信息,请参阅setRevocationEnabled方法。
| 返回(Returns) | |
|---|---|
boolean |
the current value of the RevocationEnabled flag |
void setAnyPolicyInhibited (boolean val)
设置状态以确定是否应该处理任何策略OID,如果它包含在证书中。 默认情况下,任何策略OID都不被禁止( isAnyPolicyInhibited()返回false )。
| 参数(Parameters) | |
|---|---|
val |
boolean: true if the any policy OID is to be inhibited, false otherwise |
void setCertPathCheckers (List<PKIXCertPathChecker> checkers)
设置List其他认证路径检查程序。 如果指定的List包含的对象不是PKIXCertPathChecker ,则会被忽略。
指定的每个PKIXCertPathChecker对证书执行附加检查。 通常,这些是用于处理和验证证书中包含的私有扩展的检查。 应该使用执行检查所需的任何初始化参数来实例化每个PKIXCertPathChecker 。
此方法允许复杂的应用程序扩展PKIX CertPathValidator或CertPathBuilder 。 每个指定的PKIXCertPathChecker将依次由PKIX CertPathValidator或CertPathBuilder用于处理或验证的每个证书。
无论是否设置了这些额外的PKIXCertPathChecker ,PKIX CertPathValidator或CertPathBuilder必须对每个证书执行所有必需的PKIX检查。 此规则的一个例外是如果RevocationEnabled标志设置为false(请参阅setRevocationEnabled方法)。
请注意, List提供的 List已复制,并且列表中的每个 PKIXCertPathChecker都被克隆以防止后续修改。
| 参数(Parameters) | |
|---|---|
checkers |
List: a List of PKIXCertPathCheckers. May be null, in which case no additional checkers will be used. |
| 抛出异常(Throws) | |
|---|---|
ClassCastException |
if any of the elements in the list are not of type java.security.cert.PKIXCertPathChecker |
也可以看看:
void setCertStores (List<CertStore> stores)
设置用于查找证书和CRL的CertStore列表。 可能是null ,在这种情况下将不会使用CertStore 。 列表中的第一个CertStore可能会比稍后显示的更CertStore 。
请注意,复制了 List以防止后续修改。
| 参数(Parameters) | |
|---|---|
stores |
List: a List of CertStores (or null) |
| 抛出异常(Throws) | |
|---|---|
ClassCastException |
if any of the elements in the list are not of type java.security.cert.CertStore |
也可以看看:
void setDate (Date date)
设置确定证书路径有效性的时间。 如果null ,则使用当前时间。
请注意, Date提供的 Date已被复制以防止后续修改。
| 参数(Parameters) | |
|---|---|
date |
Date: the Date, or null for the current time |
也可以看看:
void setExplicitPolicyRequired (boolean val)
设置ExplicitPolicyRequired标志。 如果此标志为真,则需要在每个证书中明确标识可接受的策略。 默认情况下,ExplicitPolicyRequired标志为false。
| 参数(Parameters) | |
|---|---|
val |
boolean: true if explicit policy is to be required, false otherwise |
void setInitialPolicies (Set<String> initialPolicies)
设置初始策略标识符(OID字符串)的Set ,表明证书用户可以接受这些策略中的任何一个用于证书路径处理。 默认情况下,任何策略都是可接受的(即所有策略),因此希望允许任何策略为可接受的用户无需调用此方法,也可以用空的Set (或null )调用它。
请注意,复制了 Set以防止后续修改。
| 参数(Parameters) | |
|---|---|
initialPolicies |
Set: a Set of initial policy OIDs in String format (or null) |
| 抛出异常(Throws) | |
|---|---|
ClassCastException |
if any of the elements in the set are not of type String |
也可以看看:
void setPolicyMappingInhibited (boolean val)
设置PolicyMappingInhibited标志。 如果此标志为真,则禁止策略映射。 默认情况下,策略映射不会被禁止(该标志为false)。
| 参数(Parameters) | |
|---|---|
val |
boolean: true if policy mapping is to be inhibited, false otherwise |
void setPolicyQualifiersRejected (boolean qualifiersRejected)
设置PolicyQualifiersRejected标志。 如果此标志为true,则在标记为关键的证书策略扩展中包含策略限定符的证书将被拒绝。 如果该标志为假,证书不会在此基础上被拒绝。
当一个PKIXParameters对象被创建时,这个标志被设置为true。 此设置反映了处理策略限定符的最常见(也是最简单的)策略。 想要使用更复杂策略的应用程序必须将此标志设置为false。
请注意,PKIX证书路径验证算法指定必须处理和验证标记为关键的证书策略扩展中的任何策略限定符。 否则,认证路径必须被拒绝。 如果policyQualifiersRejected标志设置为false,则应用程序将以这种方式验证所有策略限定符,以符合PKIX。
| 参数(Parameters) | |
|---|---|
qualifiersRejected |
boolean: the new value of the PolicyQualifiersRejected flag |
void setRevocationEnabled (boolean val)
设置RevocationEnabled标志。 如果此标志为true,则将使用基础PKIX服务提供程序的默认吊销检查机制。 如果此标志为false,则默认的撤销检查机制将被禁用(未使用)。
当一个PKIXParameters对象被创建时,这个标志被设置为true。 此设置反映了检查吊销的最常见策略,因为每个服务提供者必须支持吊销检查符合PKIX。 如果使用PKIX服务提供程序的默认撤销检查机制或替代替代撤销检查机制(通过调用addCertPathChecker或setCertPathCheckers方法),则复杂的应用程序应将此标志设置为false。
| 参数(Parameters) | |
|---|---|
val |
boolean: the new value of the RevocationEnabled flag |
void setSigProvider (String sigProvider)
设置签名提供者的名称。 创建Signature对象时,指定的提供者将是首选。 如果null或未设置,则会使用第一个支持该算法的提供商。
| 参数(Parameters) | |
|---|---|
sigProvider |
String: the signature provider's name (or null) |
也可以看看:
void setTargetCertConstraints (CertSelector selector)
设置目标证书上的必需约束。 约束被指定为CertSelector一个实例。 如果null ,则不定义约束条件。
请注意,指定的 CertSelector已克隆,以防止后续修改。
| 参数(Parameters) | |
|---|---|
selector |
CertSelector: a CertSelector specifying the constraints on the target certificate (or null) |
也可以看看:
void setTrustAnchors (Set<TrustAnchor> trustAnchors)
设置最受信任的CA的 Set 。
请注意,复制了 Set以防止后续修改。
| 参数(Parameters) | |
|---|---|
trustAnchors |
Set: a Set of TrustAnchors |
| 抛出异常(Throws) | |
|---|---|
InvalidAlgorithmParameterException |
if the specified Set is empty (trustAnchors.isEmpty() == true) |
NullPointerException |
if the specified Set is null |
ClassCastException |
if any of the elements in the set are not of type java.security.cert.TrustAnchor |
也可以看看:
String toString ()
返回描述参数的格式化字符串。
| 返回(Returns) | |
|---|---|
String |
a formatted string describing the parameters. |