public class PKIXBuilderParameters extends PKIXParameters
CertPathBuilder算法的输入。
A PKIX CertPathBuilder使用这些参数到build a CertPath ,这已经根据PKIX认证路径验证算法进行了验证。
要实例化PKIXBuilderParameters对象,应用程序必须指定由PKIX认证路径验证算法定义的一个或多个最受信任的CA。 最可靠的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的实例,它从指定的
PKIXBuilderParameters中包含的受信任证书条目填充最受信任的CA
KeyStore 。
|
PKIXBuilderParameters(Set<TrustAnchor> trustAnchors, CertSelector targetConstraints)
创建的实例
PKIXBuilderParameters与指定的
Set最受信任的CA的。
|
| 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 - a
Set的
TrustAnchor s
targetConstraints - a
CertSelector指定目标证书的约束
InvalidAlgorithmParameterException - 如果
trustAnchors是空的
(trustAnchors.isEmpty() == true)
NullPointerException - 如果
trustAnchors是
null
ClassCastException -如果任何的元件的
trustAnchors类型不是
java.security.cert.TrustAnchor
public PKIXBuilderParameters(KeyStore keystore, CertSelector targetConstraints) throws KeyStoreException, InvalidAlgorithmParameterException
PKIXBuilderParameters的实例,它从指定的PKIXBuilderParameters中包含的受信任证书条目填充最受信任的CA KeyStore 。
只考虑包含受信任的X509Certificate的密钥库条目;
所有其他证书类型将被忽略。
keystore - 一个
KeyStore ,一组最受信任的CA将被填充
targetConstraints - a
CertSelector指定目标证书的约束
KeyStoreException - 如果
keystore尚未初始化
InvalidAlgorithmParameterException - 如果
keystore不包含至少一个可信证书条目
NullPointerException - 如果
keystore是
null
public void setMaxPathLength(int maxPathLength)
CertPathBuilder实例不能构建比指定长度更长的路径。
值为0表示路径只能包含单个证书。 值-1表示路径长度是无约束的(即没有最大值)。 默认最大路径长度(如果未指定)为5.设置小于-1的值将导致抛出异常。
如果任何CA证书包含BasicConstraintsExtension ,则只要结果是较小长度的认证路径,则扩展名的pathLenConstraint字段的值将pathLenConstraint最大路径长度参数。
maxPathLength - 证书路径中可能存在的非自发
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.