public abstract class PKIXCertPathChecker
extends Object implements CertPathChecker, Cloneable
| java.lang.Object | |
| java.security.cert.PKIXCertPathChecker | |
| |
抽象类,对 X509Certificate执行一个或多个检查。
可以创建PKIXCertPathChecker类的具体实现来扩展PKIX认证路径验证算法。 例如,实施可以检查并处理证书路径中每个证书的关键私有扩展。
使用PKIXParameters和PKIXBuilderParameters类的setCertPathCheckers或addCertPathChecker方法将实例PKIXCertPathChecker作为参数传递。 对于由PKIX CertPathValidator或CertPathBuilder实现处理的每个证书,将依次调用每个PKIXCertPathChecker的check方法。
一个PKIXCertPathChecker可能会在证书路径中的连续证书上被多次调用。 预计具体子类将维持检查连续证书所需的任何内部状态。 init方法用于初始化检查器的内部状态,以便可以检查新证书路径的证书。 如有必要,有状态的实现必须覆盖clone方法,以便允许PKIX CertPathBuilder高效地回溯并尝试其他路径。 在这些情况下, CertPathBuilder可以通过恢复克隆的PKIXCertPathChecker来恢复先前的路径验证状态。
证书颁发给PKIXCertPathChecker可以是正向(从目标到最受信任的CA),也可以是反向(从最受信任的CA到目标)。 一个PKIXCertPathChecker实现必须支持反向检查(当它向相反方向提交证书时执行检查的能力),并且可能支持前向检查(当向前提供证书时执行检查的能力)。 isForwardCheckingSupported方法指示是否支持前向检查。
执行检查所需的其他输入参数可以通过该类的具体实现的构造函数来指定。
并发访问
除非另有说明,否则此类中定义的方法不是线程安全的。 需要同时访问单个对象的多个线程应该自己同步并提供必要的锁定。 每个操作单独对象的多个线程不需要同步。
Protected constructors |
|
|---|---|
PKIXCertPathChecker() 默认的构造函数。 |
|
公共方法(Public methods) |
|
|---|---|
void |
check(Certificate cert) 使用其内部状态对指定证书执行检查。 这个实现调用 |
abstract void |
check(Certificate cert, Collection<String> unresolvedCritExts) 使用其内部状态对指定证书执行检查,并从指定的代表未解决关键扩展的OID字符串集合中删除它处理的所有关键扩展。 |
Object |
clone() 返回此对象的一个克隆。 |
abstract Set<String> |
getSupportedExtensions() 返回此 |
abstract void |
init(boolean forward) 初始化此 |
abstract boolean |
isForwardCheckingSupported() 指示是否支持转发检查。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
java.security.cert.CertPathChecker
|
|
void check (Certificate cert)
使用其内部状态对指定证书执行检查。 证书按照init方法指定的顺序init 。
该实现调用 check(cert, java.util.Collections.<String>emptySet()) 。
| 参数(Parameters) | |
|---|---|
cert |
Certificate: the Certificate to be checked |
| 抛出异常(Throws) | |
|---|---|
CertPathValidatorException |
|
void check (Certificate cert, Collection<String> unresolvedCritExts)
使用其内部状态对指定证书执行检查,并从指定的代表未解决关键扩展的OID字符串集合中删除它处理的所有关键扩展。 证书按照init方法指定的顺序init 。
| 参数(Parameters) | |
|---|---|
cert |
Certificate: the Certificate to be checked |
unresolvedCritExts |
Collection: a Collection of OID strings representing the current set of unresolved critical extensions |
| 抛出异常(Throws) | |
|---|---|
CertPathValidatorException |
if the specified certificate does not pass the check |
Object clone ()
返回此对象的一个克隆。 调用Object.clone()方法。 如有必要,维护状态的所有子类必须支持并覆盖此方法。
| 返回(Returns) | |
|---|---|
Object |
a copy of this PKIXCertPathChecker |
Set<String> getSupportedExtensions ()
返回 PKIXCertPathChecker支持(即识别,能够处理)的X.509证书扩展的不可变 Set ;如果不支持扩展,则 null 。
该集合中的每个元素String代表支持的X.509扩展的对象标识符(OID)的String 。 OID由一组以句点分隔的非负整数表示。
PKIXCertPathChecker可能可以处理的所有X.509证书扩展应该包含在该集合中。
| 返回(Returns) | |
|---|---|
Set<String> |
an immutable Set of X.509 extension OIDs (in String format) supported by this PKIXCertPathChecker, or null if no extensions are supported |
void init (boolean forward)
初始化此 PKIXCertPathChecker的内部状态。
forward标志指定证书将传递给check方法(正向或反向)的顺序。 一个PKIXCertPathChecker 必须支持反向检查,并且可能支持前向检查。
| 参数(Parameters) | |
|---|---|
forward |
boolean: the order that certificates are presented to the check method. If true, certificates are presented from target to most-trusted CA (forward); if false, from most-trusted CA to target (reverse). |
| 抛出异常(Throws) | |
|---|---|
CertPathValidatorException |
if this PKIXCertPathChecker is unable to check certificates in the specified order; it should never be thrown if the forward flag is false since reverse checking must be supported |
boolean isForwardCheckingSupported ()
指示是否支持转发检查。 前向检查是指当证书以正向(从目标到最受信任的CA)呈现给check方法时, PKIXCertPathChecker执行其检查的能力。
| 返回(Returns) | |
|---|---|
boolean |
true if forward checking is supported, false otherwise |