public class PKIXParameters extends Object implements CertPathParameters
CertPathValidator算法的输入。
甲PKIX CertPathValidator使用这些参数来验证CertPath根据PKIX证书路径验证算法。
要实例化一个PKIXParameters对象,应用程序必须指定由PKIX认证路径验证算法定义的一个或多个最受信任的CA。 最可靠的CA可以使用两个构造函数之一进行指定。 一个应用程序可以调用PKIXParameters(Set) ,指定一个Set的TrustAnchor对象,每个对象都标识一个最受信任的CA。 或者,应用程序可以调用PKIXParameters(KeyStore) ,指定包含可信证书条目的KeyStore实例,每个实例将被视为最受信任的CA。
一旦PKIXParameters对象已经创建,其他参数可以(通过调用来指定setInitialPolicies或setDate ,例如),然后将PKIXParameters与一起传递CertPath被验证到CertPathValidator.validate 。
任何未设置的参数(或设置为null )将被设置为该参数的默认值。 date参数的默认值为null ,表示路径验证当前的时间。 剩余参数的默认值最小限制。
并发访问
除非另有说明,否则此类中定义的方法不是线程安全的。 需要同时访问单个对象的多个线程应在其间同步并提供必要的锁定。 每个操作单独对象的多个线程不需要同步。
CertPathValidator
| Constructor and Description |
|---|
PKIXParameters(KeyStore keystore)
创建一个
PKIXParameters的实例,它从指定的
PKIXParameters中包含的受信任证书条目填充最受信任的CA
KeyStore 。
|
PKIXParameters(Set<TrustAnchor> trustAnchors)
创建的实例
PKIXParameters与指定的
Set最受信任的CA的。
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCertPathChecker(PKIXCertPathChecker checker)
将
PKIXCertPathChecker添加到认证路径检查器列表中。
|
void |
addCertStore(CertStore store)
将
CertStore添加到用于查找证书和CRL的
CertStore列表的
CertStore 。
|
Object |
clone()
制作这个
PKIXParameters对象的副本。
|
List<PKIXCertPathChecker> |
getCertPathCheckers()
返回
List证书路径检查。
|
List<CertStore> |
getCertStores()
返回用于查找证书和CRL的不可
List的
CertStore (CertStore)。
|
Date |
getDate()
返回确定认证路径有效性的时间。
|
Set<String> |
getInitialPolicies()
返回一个不可
Set的初始策略标识符(OID字符串)Set,表明这些策略中的任何一个对证书用户来说都是可接受的,用于认证路径处理。
|
boolean |
getPolicyQualifiersRejected()
获取PolicyQualifiersRejected标志。
|
String |
getSigProvider()
返回签名提供者的名称,或
null如果没有设置。
|
CertSelector |
getTargetCertConstraints()
返回目标证书所需的约束。
|
Set<TrustAnchor> |
getTrustAnchors()
返回不可替代的
Set最受信任的CA。
|
boolean |
isAnyPolicyInhibited()
检查是否应将任何策略OID包含在证书中进行处理。
|
boolean |
isExplicitPolicyRequired()
检查是否需要明确的策略。
|
boolean |
isPolicyMappingInhibited()
检查策略映射是否被禁止。
|
boolean |
isRevocationEnabled()
检查RevocationEnabled标志。
|
void |
setAnyPolicyInhibited(boolean val)
设置状态以确定是否应将任何策略OID包含在证书中进行处理。
|
void |
setCertPathCheckers(List<PKIXCertPathChecker> checkers)
设置一个
List的认证路径检查器List。
|
void |
setCertStores(List<CertStore> stores)
设置列表
CertStore在查找证书和CRL时所使用秒。
|
void |
setDate(Date date)
设置认证路径的有效性应该被确定的时间。
|
void |
setExplicitPolicyRequired(boolean val)
设置ExplicitPolicyRequired标志。
|
void |
setInitialPolicies(Set<String> initialPolicies)
设置
Set初始策略标识符(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的
Set 。
|
String |
toString()
返回描述参数的格式化字符串。
|
public PKIXParameters(Set<TrustAnchor> trustAnchors) throws InvalidAlgorithmParameterException
trustAnchors - a
Set (
TrustAnchor )
InvalidAlgorithmParameterException - 如果指定的
Set为空
(trustAnchors.isEmpty() == true)
NullPointerException - 如果指定的
Set是
null
ClassCastException -如果任何在元素
Set类型不是
java.security.cert.TrustAnchor
public PKIXParameters(KeyStore keystore) throws KeyStoreException, InvalidAlgorithmParameterException
PKIXParameters的实例,它从指定的PKIXParameters中包含的受信任证书条目填充最受信任的CA KeyStore 。
仅考虑包含受信任的X509Certificates密钥存储条目;
所有其他证书类型将被忽略。
keystore - 一个
KeyStore ,一组最受信任的CA将被填充
KeyStoreException - 如果密钥库尚未初始化
InvalidAlgorithmParameterException - 如果密钥库不包含至少一个可信证书条目
NullPointerException - 如果密钥库是
null
public Set<TrustAnchor> getTrustAnchors()
Set最受信任的CA。
Set的
TrustAnchor s(从不
null )
setTrustAnchors(java.util.Set<java.security.cert.TrustAnchor>)
public void setTrustAnchors(Set<TrustAnchor> trustAnchors) throws InvalidAlgorithmParameterException
Set 。
请注意, Set被复制以防止后续修改。
trustAnchors - a
Set (
TrustAnchor )
InvalidAlgorithmParameterException - 如果指定的
Set为空
(trustAnchors.isEmpty() == true)
NullPointerException - 如果指定的
Set是
null
ClassCastException - 如果集合中的任何元素不是类型
java.security.cert.TrustAnchor
getTrustAnchors()
public Set<String> getInitialPolicies()
Set的初始策略标识符(OID字符串)Set,这表明这些策略中的任何一个对证书用户来说都是可接受的,用于认证路径处理。
默认返回值为空Set ,这被解释为意味着任何策略都是可接受的。
Set的初始策略OID String ,或空的Set (意味着任何策略都可以接受)。
从不返回null 。
setInitialPolicies(java.util.Set<java.lang.String>)
public void setInitialPolicies(Set<String> initialPolicies)
Set初始策略标识符(OID字符串),表明这些政策中的任何一个可以接受的认证路径处理的目的,证书用户。
默认情况下,任何策略都可以接受(即所有策略),因此希望允许任何策略可接受的用户不需要调用此方法,也可以使用空的Set (或null )调用。
请注意, Set被复制以防止后续修改。
initialPolicies -
String格式的
Set初始策略OID(或
null )
ClassCastException - 如果集合中的任何元素不是类型
String
getInitialPolicies()
public void setCertStores(List<CertStore> stores)
CertStore在查找证书和CRL时所使用秒。
可能是null ,在这种情况下不会使用CertStore 。
列表中的第一个CertStore可能优于稍后出现的那些。
请注意, List被复制以防止后续修改。
stores - a
List of
CertStore s(或
null )
ClassCastException - 如果列表中的任何元素不是类型
java.security.cert.CertStore
getCertStores()
public void addCertStore(CertStore store)
CertStore添加到用于查找证书和CRL的
CertStore列表的
CertStore 。
store - 加CertStore 。
如果null ,该商店被忽略(未添加到列表中)。
public List<CertStore> getCertStores()
List的
CertStore的CertStore。
List的
CertStore s(可能是空的,但从不
null )
setCertStores(java.util.List<java.security.cert.CertStore>)
public void setRevocationEnabled(boolean val)
当创建一个PKIXParameters对象时,该标志设置为true。 此设置反映了检查撤销的最常见策略,因为每个服务提供商必须支持撤销检查以符合PKIX。 如果使用PKIX服务提供商的默认撤销检查机制或替代撤销检查机制(通过调用addCertPathChecker或setCertPathCheckers方法),复杂的应用程序应将此标志设置为false。
val - RevocationEnabled标志的新值
public boolean isRevocationEnabled()
setRevocationEnabled方法。
public void setExplicitPolicyRequired(boolean val)
val -
true如果需要明确的政策,
false否则
public boolean isExplicitPolicyRequired()
true如果需要明确的政策,
false否则
public void setPolicyMappingInhibited(boolean val)
val -
true如果
true策略映射,
false否则
public boolean isPolicyMappingInhibited()
public void setAnyPolicyInhibited(boolean val)
isAnyPolicyInhibited()返回false )。
val -
true如果任何政策OID被禁止,
false否则
public boolean isAnyPolicyInhibited()
true如果任何策略OID被禁止,
false false
public void setPolicyQualifiersRejected(boolean qualifiersRejected)
当创建一个PKIXParameters对象时,该标志设置为true。 此设置反映了处理策略限定词的最常用(最简单)策略。 希望使用更复杂的策略的应用程序必须将此标志设置为false。
请注意,PKIX认证路径验证算法指定必须处理和验证证书策略扩展中标记为关键的任何策略限定符。 否则认证路径必须被拒绝。 如果policyQualifiersRejected标志设置为false,则应用程序以此方式验证所有策略限定符,以便符合PKIX标准。
qualifiersRejected - PolicyQualifiersRejected标志的新值
getPolicyQualifiersRejected() , PolicyQualifierInfo
public boolean getPolicyQualifiersRejected()
创建PKIXParameters对象时,此标志设置为true。 此设置反映了处理策略限定词的最常用(最简单)策略。 希望使用更复杂的策略的应用程序必须将此标志设置为false。
setPolicyQualifiersRejected(boolean)
public Date getDate()
null ,则使用当前时间。
请注意,返回的Date被复制以防止后续修改。
Date或
null如果没有设置
setDate(java.util.Date)
public void setDate(Date date)
null ,则使用当前时间。
请注意, Date提供的Date将被复制以防止后续修改。
date - 当前时间为
Date或
null
getDate()
public void setCertPathCheckers(List<PKIXCertPathChecker> checkers)
List的认证路径检查器的List。
如果指定的List包含一个对象,它是不是一个PKIXCertPathChecker ,它将被忽略。
每个PKIXCertPathChecker指定的实现对证书的附加检查。 通常,这些是处理和验证证书中包含的私有扩展的检查。 每个PKIXCertPathChecker应该用执行检查所需的任何初始化参数进行实例化。
该方法允许复杂的应用程序扩展PKIX CertPathValidator或CertPathBuilder 。 指定的PKIXCertPathChecker的每一个将被CertPathValidator或CertPathBuilder的每个证书的PKIX CertPathValidator或CertPathBuilder调用。
无论这些额外的PKIXCertPathChecker是否设置,PKIX CertPathValidator或CertPathBuilder必须对每个证书执行所有必需的PKIX检查。 此规则的一个例外是如果RevocationEnabled标志设置为false(请参阅setRevocationEnabled方法)。
请注意, List提供的List被复制,并且克隆了列表中的每个PKIXCertPathChecker以防止后续修改。
checkers - a List的PKIXCertPathChecker s。
可能是null ,在这种情况下不会使用额外的检查。
ClassCastException - 如果列表中的任何元素不是类型
java.security.cert.PKIXCertPathChecker
getCertPathCheckers()
public List<PKIXCertPathChecker> getCertPathCheckers()
List证书路径检查。
返回的List是不可变的,并且PKIXCertPathChecker中的每个List被克隆以防止随后的修改。
List的
PKIXCertPathChecker s(可能是空的,但不是
null )
setCertPathCheckers(java.util.List<java.security.cert.PKIXCertPathChecker>)
public void addCertPathChecker(PKIXCertPathChecker checker)
PKIXCertPathChecker添加到认证路径检查器列表中。
有关详细信息,请参阅setCertPathCheckers方法。
请注意, PKIXCertPathChecker被克隆以防止后续修改。
checker - 一个PKIXCertPathChecker添加到检查列表。
如果null ,检查器被忽略(未添加到列表中)。
public String getSigProvider()
null如果没有设置。
null )
setSigProvider(java.lang.String)
public void setSigProvider(String sigProvider)
sigProvider - 签名提供者的姓名(或
null )
getSigProvider()
public CertSelector getTargetCertConstraints()
CertSelector 。
如果null ,没有约束被定义。
请注意,返回的CertSelector被克隆以防止后续修改。
CertSelector指定目标证书的约束(或
null )
setTargetCertConstraints(java.security.cert.CertSelector)
public void setTargetCertConstraints(CertSelector selector)
CertSelector 。
如果null没有定义约束。
请注意, CertSelector CertSelector被克隆以防止后续修改。
selector - a
CertSelector指定目标证书(或
null )的
null
getTargetCertConstraints()
public Object clone()
PKIXParameters对象的副本。
副本的更改不会影响原始文件,反之亦然。
clone在接口
CertPathParameters
clone在
Object
PKIXParameters对象的副本
Cloneable
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.