public class PKIXBuilderParameters extends PKIXParameters
CertPathBuilder
算法的实现。
一个PKIX CertPathBuilder
使用这些参数来build
一CertPath
已根据PKIX证书路径验证算法验证。
实例化一个PKIXBuilderParameters
对象,应用程序必须指定一个或多个最受信任的CA的证书路径验证算法定义的实现。可以使用两个构造函数中的一个指定最受信任的钙。应用程序可以调用指定的PKIXBuilderParameters(Set, CertSelector)
,Set
TrustAnchor
对象,其中每个识别最受信任的CA或者,应用程序可以调用PKIXBuilderParameters(KeyStore, CertSelector)
,指定一个包含可信证书条目KeyStore
实例,每一个都会被认为是最受信任的CA
此外,应用程序必须指定,CertPathBuilder
将试图建立一个路径约束的目标证书。约束被指定为一个CertSelector
对象。这些限制应该提供CertPathBuilder
与找到目标证书足够的搜索条件。一个X509Certificate
最小准则通常包括标的名称和/或一个或多个主题备用名称。如果有足够多的标准没有规定,这CertPathBuilder
可以把一个CertPathBuilderException
。
并发访问
除非另有说明,在这个类中定义的方法不是线程安全的。需要访问一个单一对象的多个线程同时应同步,并提供必要的锁。多线程每个操作单独的对象不需要同步。
CertPathBuilder
Constructor and Description |
---|
PKIXBuilderParameters(KeyStore keystore, CertSelector targetConstraints)
创建
PKIXBuilderParameters 填充包含在指定
KeyStore 最受信任的CA的证书信任项集合中的一个实例。
|
PKIXBuilderParameters(Set<TrustAnchor> trustAnchors, CertSelector targetConstraints)
创建具有指定
Set 最受信任的CA的
PKIXBuilderParameters 实例。
|
Modifier and Type | Method and Description |
---|---|
int |
getMaxPathLength()
返回在认证路径中可能存在的中间非自颁发证书的最大数量的值。
|
void |
setMaxPathLength(int maxPathLength)
设置可能存在于证书路径中的非自颁发的中间证书的最大数量的值。
|
String |
toString()
返回一个描述参数的格式化字符串。
|
addCertPathChecker, addCertStore, clone, getCertPathCheckers, getCertStores, getDate, getInitialPolicies, getPolicyQualifiersRejected, getSigProvider, getTargetCertConstraints, getTrustAnchors, isAnyPolicyInhibited, isExplicitPolicyRequired, isPolicyMappingInhibited, isRevocationEnabled, setAnyPolicyInhibited, setCertPathCheckers, setCertStores, setDate, setExplicitPolicyRequired, setInitialPolicies, setPolicyMappingInhibited, setPolicyQualifiersRejected, setRevocationEnabled, setSigProvider, setTargetCertConstraints, setTrustAnchors
public PKIXBuilderParameters(Set<TrustAnchor> trustAnchors, CertSelector targetConstraints) throws InvalidAlgorithmParameterException
trustAnchors
-
Set
的
TrustAnchor
s
targetConstraints
-
CertSelector
指定目标证书的约束
InvalidAlgorithmParameterException
-如果
trustAnchors
是空的
(trustAnchors.isEmpty() == true)
null
trustAnchors
NullPointerException
ClassCastException
-如果任何的
trustAnchors
元素不是
java.security.cert.TrustAnchor
型
public PKIXBuilderParameters(KeyStore keystore, CertSelector targetConstraints) throws KeyStoreException, InvalidAlgorithmParameterException
PKIXBuilderParameters
填充包含在指定
KeyStore
最受信任的CA的证书信任项集合中的一个实例。只有密钥项包含被认为是值得信赖的
X509Certificate
s;所有其他的证书类型被忽略。
keystore
-
KeyStore
从其中最信任的CAs集将被填充
targetConstraints
-
CertSelector
指定目标证书的约束
KeyStoreException
-如果
keystore
尚未初始化
InvalidAlgorithmParameterException
-如果
keystore
不包含至少一个受信任的证书项
null
keystore
NullPointerException
public void setMaxPathLength(int maxPathLength)
CertPathBuilder
实例不PKIX构建路径长度比指定的时间。
一个值为0意味着该路径只能包含一个证书。A值为- 1意味着路径长度是不受约束的(即没有最大值)。默认的最大路径长度,如果没有指定,是5。设置一个小于1的值将导致一个异常被抛出。
如果有任何的CA证书包含BasicConstraintsExtension
,扩建的pathLenConstraint
字段的值覆盖的最大路径长度参数时,结果是一个小的长度认证路径。
maxPathLength
-非自颁发的中级证书,可以在证书路径存在的最大数量
InvalidParameterException
-如果
maxPathLength
设置的值小于1
getMaxPathLength()
public int getMaxPathLength()
setMaxPathLength(int)
方法。
setMaxPathLength(int)
public String toString()
toString
方法重写,继承类
PKIXParameters
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.