Most visited

Recently visited

Added in API level 1

CertPathValidatorException

public class CertPathValidatorException
extends GeneralSecurityException

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.security.GeneralSecurityException
         ↳ java.security.cert.CertPathValidatorException


指示验证认证路径时遇到的各种问题之一的例外情况。

CertPathValidatorException提供了对包装异常的支持。 getCause方法返回引发此异常的throwable(如果有的话)将被抛出。

CertPathValidatorException还可能包含在抛出异常时正在验证的证书路径,导致引发异常的证书路径中的证书索引以及导致失败的原因。 使用getCertPathgetIndex ,并getReason方法来获取这些信息。

并发访问

除非另有说明,否则此类中定义的方法不是线程安全的。 需要同时访问单个对象的多个线程应该自己同步并提供必要的锁定。 每个操作单独对象的多个线程不需要同步。

也可以看看:

Summary

Nested classes

枚举 CertPathValidatorException.BasicReason

BasicReason列举了任何类型的认证路径可能无效的潜在原因。

interface CertPathValidatorException.Reason

验证算法失败的原因。

Public constructors

CertPathValidatorException()

创建一个没有详细信息的 CertPathValidatorException

CertPathValidatorException(String msg)

用给定的详细信息创建一个 CertPathValidatorException

CertPathValidatorException(Throwable cause)

创建一个包装指定的throwable的 CertPathValidatorException

CertPathValidatorException(String msg, Throwable cause)

用指定的详细信息和原因创建一个 CertPathValidatorException

CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index)

用指定的详细信息,原因,认证路径和索引创建一个 CertPathValidatorException

CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index, CertPathValidatorException.Reason reason)

用指定的详细信息,原因,认证路径,索引和原因创建一个 CertPathValidatorException

Public methods

CertPath getCertPath()

返回抛出异常时正在验证的证书路径。

int getIndex()

返回导致引发异常的证书路径中的证书的索引。

CertPathValidatorException.Reason getReason()

返回验证失败的原因。

Inherited methods

From class java.lang.Throwable
From class java.lang.Object

Public constructors

CertPathValidatorException

Added in API level 1
CertPathValidatorException ()

创建一个没有详细信息的 CertPathValidatorException

CertPathValidatorException

Added in API level 1
CertPathValidatorException (String msg)

用给定的详细信息创建一个CertPathValidatorException 详细消息是描述这种特殊异常的String

Parameters
msg String: the detail message

CertPathValidatorException

Added in API level 1
CertPathValidatorException (Throwable cause)

创建一个包装指定的throwable的CertPathValidatorException 这允许将任何异常转换为CertPathValidatorException ,同时保留有关包装异常的信息,这对于调试可能很有用。 详细消息设置为( cause==null ? null : cause.toString() )(通常包含原因的类和详细消息)。

Parameters
cause Throwable: the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

CertPathValidatorException

Added in API level 1
CertPathValidatorException (String msg, 
                Throwable cause)

用指定的详细信息和原因创建一个 CertPathValidatorException

Parameters
msg String: the detail message
cause Throwable: the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

CertPathValidatorException

Added in API level 1
CertPathValidatorException (String msg, 
                Throwable cause, 
                CertPath certPath, 
                int index)

用指定的详细信息,原因,认证路径和索引创建 CertPathValidatorException

Parameters
msg String: the detail message (or null if none)
cause Throwable: the cause (or null if none)
certPath CertPath: the certification path that was in the process of being validated when the error was encountered
index int: the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a CertPath is zero based.
Throws
IndexOutOfBoundsException if the index is out of range (index < -1 || (certPath != null && index >= certPath.getCertificates().size())
IllegalArgumentException if certPath is null and index is not -1

CertPathValidatorException

Added in API level 24
CertPathValidatorException (String msg, 
                Throwable cause, 
                CertPath certPath, 
                int index, 
                CertPathValidatorException.Reason reason)

使用指定的详细信息,原因,证书路径,索引和原因创建 CertPathValidatorException

Parameters
msg String: the detail message (or null if none)
cause Throwable: the cause (or null if none)
certPath CertPath: the certification path that was in the process of being validated when the error was encountered
index int: the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a CertPath is zero based.
reason CertPathValidatorException.Reason: the reason the validation failed
Throws
IndexOutOfBoundsException if the index is out of range (index < -1 || (certPath != null && index >= certPath.getCertificates().size())
IllegalArgumentException if certPath is null and index is not -1
NullPointerException if reason is null

Public methods

getCertPath

Added in API level 1
CertPath getCertPath ()

返回抛出异常时正在验证的证书路径。

Returns
CertPath the CertPath that was being validated when the exception was thrown (or null if not specified)

getIndex

Added in API level 1
int getIndex ()

返回导致引发异常的证书路径中的证书的索引。 请注意, CertPath中的证书列表基于零。 如果没有设置索引,则返回-1。

Returns
int the index that has been set, or -1 if none has been set

getReason

Added in API level 24
CertPathValidatorException.Reason getReason ()

返回验证失败的原因。 原因与由getIndex()返回的证书的索引相关联。

Returns
CertPathValidatorException.Reason the reason that the validation failed, or BasicReason.UNSPECIFIED if a reason has not been specified

Hooray!