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, setTrustAnchorspublic PKIXBuilderParameters(Set<TrustAnchor> trustAnchors, CertSelector targetConstraints) throws InvalidAlgorithmParameterException
trustAnchors -
Set的
TrustAnchors
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的证书信任项集合中的一个实例。只有密钥项包含被认为是值得信赖的
X509Certificates;所有其他的证书类型被忽略。
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.