|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.security.cert.CertPathValidator
public class CertPathValidator
验证证书路径(也称为证书链)的类。
此类使用《Java Cryptography Architecture》中所描述的、基于提供程序的架构。要创建一个 CertPathValidator,应调用某个静态 getInstance 方法、传入所需的 CertPathValidator 算法名称、或者所需的提供程序名称。
一旦创建了 CertPathValidator 对象,就可使用它来验证证书路径,方法是调用 validate 方法并向其传递要验证的 CertPath 和一个特定于算法的参数集。如果验证成功,则在一个实现了 CertPathValidatorResult 接口的对象中返回结果。
并发访问
可保证此类的静态方法是线程安全的。多个线程可以并发调用此类中所定义的静态方法,而不会产生什么恶果。
但是,对于此类所定义的非静态方法并非如此。除非具体的提供程序另行指定,否则需要并发访问单个 CertPathValidator 实例的多个线程应该在它们之间实现同步并提供所需的锁定。对于每个线程都操作一个不同 CertPathValidator 实例的多个线程而言,无需实现同步。
CertPath| 构造方法摘要 | |
|---|---|
protected |
CertPathValidator(CertPathValidatorSpi validatorSpi,
Provider provider,
String algorithm)
创建一个给定算法的 CertPathValidator 对象,并在其中封装给定的提供程序实现(SPI 对象)。 |
| 方法摘要 | |
|---|---|
String |
getAlgorithm()
返回此 CertPathValidator 的算法名称。 |
static String |
getDefaultType()
返回 Java 安全属性文件中所指定的默认 CertPathValidator 类型,如果没有此属性,则返回字符串 "PKIX"。 |
static CertPathValidator |
getInstance(String algorithm)
返回实现了指定算法的 CertPathValidator 对象。 |
static CertPathValidator |
getInstance(String algorithm,
Provider provider)
返回实现指定算法(由指定的提供程序提供)的 CertPathValidator 对象。 |
static CertPathValidator |
getInstance(String algorithm,
String provider)
返回实现指定算法(由指定的提供程序提供)的 CertPathValidator 对象。 |
Provider |
getProvider()
返回此 CertPathValidator 的 Provider。 |
CertPathValidatorResult |
validate(CertPath certPath,
CertPathParameters params)
使用指定的算法参数集验证指定的证书路径。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
protected CertPathValidator(CertPathValidatorSpi validatorSpi, Provider provider, String algorithm)
CertPathValidator 对象,并在其中封装给定的提供程序实现(SPI 对象)。
validatorSpi - 提供程序实现provider - 提供程序algorithm - 算法名称| 方法详细信息 |
|---|
public static CertPathValidator getInstance(String algorithm) throws NoSuchAlgorithmException
CertPathValidator 对象。
如果默认提供程序包提供了指定 CertPathValidator 算法的实现,则返回包含该实现的 CertPathValidator 实例。如果默认包中不存在所请求的算法,则搜索其他包。
algorithm - 所请求的 CertPathValidator 算法名称
CertPathValidator 对象
NoSuchAlgorithmException - 如果所请求的算法在默认提供程序包,或者搜索的所有其他提供程序包中都不可用public static CertPathValidator getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException
CertPathValidator 对象。
algorithm - 所请求的 CertPathValidator 算法名称provider - 提供程序的名称
CertPathValidator 对象
NoSuchAlgorithmException - 如果指定的提供程序未提供所请求的算法
NoSuchProviderException - 如果尚未配置提供程序
IllegalArgumentException - 如果 provider 为 nullpublic static CertPathValidator getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException
CertPathValidator 对象。注:该 provider 不必被注册。
algorithm - 所请求的 CertPathValidator 算法名称provider - 提供程序
CertPathValidator 对象
NoSuchAlgorithmException - 如果指定的提供程序未提供所请求的算法
IllegalArgumentException - 如果 provider 为 null。public final Provider getProvider()
CertPathValidator 的 Provider。
CertPathValidator 的 Providerpublic final String getAlgorithm()
CertPathValidator 的算法名称。
CertPathValidator 的算法名称public final CertPathValidatorResult validate(CertPath certPath, CertPathParameters params) throws CertPathValidatorException, InvalidAlgorithmParameterException
所指定的 CertPath 必须是该验证算法所支持的类型,否则会抛出 InvalidAlgorithmParameterException。例如,实现 PKIX 算法的 CertPathValidator 会验证 X.509 类型的 CertPath 对象。
certPath - 要被验证的 CertPathparams - 算法参数
CertPathValidatorException - 如果 CertPath 未通过验证
InvalidAlgorithmParameterException - 如果指定的参数或指定 CertPath 的类型不适合此 CertPathValidatorpublic static final String getDefaultType()
CertPathValidator 类型,如果没有此属性,则返回字符串 "PKIX"。Java 安全属性文件位于指定的 <JAVA_HOME>/lib/security/java.security 文件中,其中 <JAVA_HOME> 是指安装 JDK 的目录。
对于调用某个 getInstance 方法时不希望使用硬编码 CertPathValidator 类型,以及在用户未指定所用 CertPathValidator 类型的情况下希望提供默认类型的应用程序而言,可以使用默认的 CertPathValidator 类型。
通过将 "certpathvalidator.type" 安全属性(在 Java 安全属性文件中)的值设置为所需的类型即可更改默认的 CertPathValidator 类型。
CertPathValidator 类型,如果没有此属性,则返回字符串 "PKIX"。
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。